diff --git a/js/component/common.js b/js/component/common.js index a942b5ada..cd6d52576 100644 --- a/js/component/common.js +++ b/js/component/common.js @@ -169,6 +169,77 @@ var WatchLink = React.createClass({ } }); +var requiredFieldWarningStyle = { + color: '#cc0000', + transition: 'opacity 400ms ease-in', +}; +var FormField = React.createClass({ + _type: null, + _element: null, + + propTypes: { + type: React.PropTypes.string.isRequired, + hidden: React.PropTypes.bool, + }, + getInitialState: function() { + return { + warningState: 'hidden', + } + }, + componentWillMount: function() { + if (['text', 'radio', 'file'].indexOf(this.props.type) != -1) { + this._element = 'input'; + this._type = this.props.type; + } else { + // Non field, e.g.