-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update version of i18next-localstorage-cache to 1.1.0 (#1911)
* Update version number * new meta key in registry, allow package registry items to override default meta title * lint fixes * Rewrite example payment settings pane to react #1817 (#1848) * Have base to be release20 * Nitpick change on index * Convert social settings to React with new cards (#1854) * Convert social settings to React with new cards * Save card open state * Add new SettingsCard component - SettingsCard component wraps many components necessary for a dashboard settings card. - Added method for updating user preferences * Added a custom React semi-auto Form component To help standardize all settings cards a new `Form` component has been added that can use `SimpleSchema` to generate a basic, single level form with validation. * Update social settings and form component - Add success message on submit - Remove unused code - Fix glitch with auto form and error messages * Added prop type for switchName * Update version of i18next-localstorage-cache to 1.1.0
- Loading branch information
1 parent
7cf4ea6
commit 5103ee8
Showing
33 changed files
with
818 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
imports/plugins/core/ui/client/components/cards/settingsCard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* Settings Card is a composite component to standardize the | ||
* creation settings cards (panels) in the dashboard. | ||
*/ | ||
|
||
import React, { Component, PropTypes } from "react"; | ||
import Blaze from "meteor/gadicc:blaze-react-component"; | ||
import { Card, CardHeader, CardBody } from "/imports/plugins/core/ui/client/components"; | ||
|
||
class SettingsCard extends Component { | ||
static propTypes = { | ||
children: PropTypes.node, | ||
enabled: PropTypes.bool, | ||
expanded: PropTypes.bool, | ||
i18nKeyTitle: PropTypes.string, | ||
icon: PropTypes.string, | ||
name: PropTypes.string, | ||
onExpand: PropTypes.func, | ||
onSwitchChange: PropTypes.func, | ||
template: PropTypes.any, | ||
title: PropTypes.string | ||
} | ||
|
||
handleSwitchChange = (event, isChecked) => { | ||
if (typeof this.props.onSwitchChange === "function") { | ||
this.props.onSwitchChange(event, isChecked, this.props.name, this); | ||
} | ||
} | ||
|
||
renderCardBody() { | ||
if (this.props.template) { | ||
return ( | ||
<Blaze template={this.props.template} /> | ||
); | ||
} | ||
|
||
return this.props.children; | ||
} | ||
|
||
render() { | ||
return ( | ||
<Card | ||
expandable={true} | ||
onExpand={this.props.onExpand} | ||
expanded={this.props.expanded} | ||
name={this.props.name} | ||
> | ||
<CardHeader | ||
i18nKeyTitle={this.props.i18nKeyTitle} | ||
icon={this.props.icon} | ||
title={this.props.title} | ||
showSwitch={true} | ||
actAsExpander={true} | ||
switchOn={this.props.enabled} | ||
switchName={this.props.name} | ||
expandOnSwitchOn={true} | ||
onSwitchChange={this.handleSwitchChange} | ||
/> | ||
<CardBody expandable={true}> | ||
{this.renderCardBody()} | ||
</CardBody> | ||
</Card> | ||
); | ||
} | ||
} | ||
|
||
export default SettingsCard; |
Oops, something went wrong.