diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-07 21:16:47 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-07 21:16:47 +0900 |
commit | 05ef6a8ca35aaa801c11eb6b4896caa3690058af (patch) | |
tree | 2c7708ca91ac2b462cc86aa28612e3d3943496f3 /src/settings/components/ui/Input.jsx | |
parent | 457d954e08923b4accd28a919c72d0b61db1bb98 (diff) | |
parent | 27d0a7f37d24a0ad68a8ccb7dee18fc1d00eea58 (diff) |
Merge pull request #578 from ueokande/move-to-typescript
Move to TypeScript
Diffstat (limited to 'src/settings/components/ui/Input.jsx')
-rw-r--r-- | src/settings/components/ui/Input.jsx | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src/settings/components/ui/Input.jsx b/src/settings/components/ui/Input.jsx deleted file mode 100644 index 13a246b..0000000 --- a/src/settings/components/ui/Input.jsx +++ /dev/null @@ -1,60 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import './Input.scss'; - -class Input extends React.Component { - - renderText(props) { - let inputClassName = props.error ? 'input-error' : ''; - return <div className='settings-ui-input'> - <label htmlFor={props.id}>{ props.label }</label> - <input type='text' className={inputClassName} {...props} /> - </div>; - } - - renderRadio(props) { - let inputClassName = props.error ? 'input-error' : ''; - return <div className='settings-ui-input'> - <label> - <input type='radio' className={inputClassName} {...props} /> - { props.label } - </label> - </div>; - } - - renderTextArea(props) { - let inputClassName = props.error ? 'input-error' : ''; - return <div className='settings-ui-input'> - <label - htmlFor={props.id} - >{ props.label }</label> - <textarea className={inputClassName} {...props} /> - <p className='settings-ui-input-error'>{ this.props.error }</p> - </div>; - } - - render() { - let { type } = this.props; - - switch (this.props.type) { - case 'text': - return this.renderText(this.props); - case 'radio': - return this.renderRadio(this.props); - case 'textarea': - return this.renderTextArea(this.props); - default: - console.warn(`Unsupported input type ${type}`); - } - return null; - } -} - -Input.propTypes = { - type: PropTypes.string, - error: PropTypes.string, - label: PropTypes.string, - value: PropTypes.string, -}; - -export default Input; |