-
-
Save JulienMelissas/f383d64243acba7c675935180ccc29f0 to your computer and use it in GitHub Desktop.
Revisions
-
JulienMelissas revised this gist
Sep 5, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -36,7 +36,7 @@ const Select = React.createClass({ ref="select" onChange={this.changeValue} value={this.getValue()} /> {errorMessage ? <span>{errorMessage}</span> : null} </div> ); -
JulienMelissas revised this gist
Sep 5, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -37,7 +37,7 @@ const Select = React.createClass({ onChange={this.changeValue} value={this.getValue()} /> {errorMessage ? <span>{errorMessage}</span> : null} </div> ); } -
JulienMelissas revised this gist
Sep 5, 2016 . 1 changed file with 5 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,16 +2,15 @@ import React from 'react'; import Formsy from 'formsy-react'; import ReactSelect from 'react-select'; // Dont forget to import your styles somewhere const Select = React.createClass({ mixins: [Formsy.Mixin], propTypes: { name: React.PropTypes.string.isRequired, placeholder: React.PropTypes.string, multiple: React.PropTypes.bool, options: React.PropTypes.array.isRequired }, @@ -31,17 +30,14 @@ const Select = React.createClass({ return ( <div className={'form-group' + (className ? ' ' + className : '') }> <label htmlFor={this.props.name}>{this.props.title}</label> <ReactSelect {...this.props} ref="select" onChange={this.changeValue} value={this.getValue()} /> {<span className='error-message'>{errorMessage}</span> </div> ); } -
keeth revised this gist
May 22, 2015 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,11 @@ const Select = React.createClass({ }, changeValue(value, selectedOptions) { if (this.props.multiple) { this.setValue(selectedOptions.map(option => option.value)); } else { this.setValue(value); } }, render() { @@ -43,4 +47,4 @@ const Select = React.createClass({ } }); export default Select; -
keeth created this gist
May 21, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ import React from 'react'; import Formsy from 'formsy-react'; import ReactSelect from 'react-select'; import './Select.less'; const Select = React.createClass({ mixins: [Formsy.Mixin], propTypes: { id: React.PropTypes.string.isRequired, title: React.PropTypes.string.isRequired, name: React.PropTypes.string.isRequired, multiple: React.PropTypes.bool, options: React.PropTypes.array.isRequired }, changeValue(value, selectedOptions) { this.setValue(selectedOptions); }, render() { var className = this.showRequired() ? 'required' : this.showError() ? 'error' : null; var errorMessage = this.getErrorMessage(); return ( <div className={'form-group' + (className ? ' ' + className : '') }> <label htmlFor={this.props.id}>{this.props.title}</label> <ReactSelect ref="select" id={this.props.id} name={this.props.name} multi={this.props.multiple} onChange={this.changeValue} value={this.getValue()} options={this.props.options} /> <span className='error-message'>{errorMessage}</span> </div> ); } }); export default Select;