Skip to content

Commit

Permalink
Merge pull request #1538 from oliviertassinari/select-field-mixin
Browse files Browse the repository at this point in the history
[SelectField] add purerender mixin
  • Loading branch information
shaurya947 committed Sep 24, 2015
2 parents c2f7942 + 6552bf3 commit 4f67833
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/select-field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,28 @@ const TextField = require('./text-field');
const DropDownMenu = require('./drop-down-menu');
const DefaultRawTheme = require('./styles/raw-themes/light-raw-theme');
const ThemeManager = require('./styles/theme-manager');
const ContextPure = require('./mixins/context-pure');

const SelectField = React.createClass({

mixins: [StylePropable],
mixins: [
StylePropable,
ContextPure,
],

contextTypes: {
muiTheme: React.PropTypes.object,
},

statics: {
getChildrenClasses() {
return [
TextField,
DropDownMenu,
];
},
},

propTypes: {
errorText: React.PropTypes.string,
floatingLabelText: React.PropTypes.string,
Expand Down Expand Up @@ -68,7 +81,7 @@ const SelectField = React.createClass({
let newMuiTheme = nextContext.muiTheme ? nextContext.muiTheme : this.state.muiTheme;
this.setState({muiTheme: newMuiTheme});
},

getStyles() {
let styles = {
root: {
Expand Down Expand Up @@ -105,15 +118,15 @@ const SelectField = React.createClass({
}
}
else {
styles.error.bottom = -15;
styles.error.bottom = -15;
}

return styles;
},

render() {
let styles = this.getStyles();
let {
const styles = this.getStyles();
const {
style,
labelStyle,
iconStyle,
Expand All @@ -130,7 +143,7 @@ const SelectField = React.createClass({
...other,
} = this.props;

let textFieldProps = {
const textFieldProps = {
style: this.mergeAndPrefix(styles.input, style),
floatingLabelText: floatingLabelText,
floatingLabelStyle: floatingLabelStyle,
Expand All @@ -139,7 +152,7 @@ const SelectField = React.createClass({
errorText: errorText,
errorStyle: this.mergeAndPrefix(styles.error, errorStyle),
};
let dropDownMenuProps = {
const dropDownMenuProps = {
menuItems: menuItems,
disabled: disabled,
style: this.mergeAndPrefix(styles.root, selectFieldRoot),
Expand Down

0 comments on commit 4f67833

Please sign in to comment.