-
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.
Merge pull request #1920 from reactioncommerce/development
Release 0.19.1
- Loading branch information
Showing
78 changed files
with
1,239 additions
and
262 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
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.