You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.0 KiB
55 lines
1.0 KiB
7 years ago
|
import React from 'react'
|
||
|
import PropTypes from 'prop-types'
|
||
|
import { withStyles } from 'material-ui/styles'
|
||
|
import { default as MaterialTextField } from 'material-ui/TextField'
|
||
|
|
||
|
const styles = {
|
||
|
cssLabel: {
|
||
|
'&$cssFocused': {
|
||
|
color: '#aeaeae',
|
||
|
},
|
||
|
fontWeight: '400',
|
||
|
color: '#aeaeae',
|
||
|
},
|
||
|
cssFocused: {},
|
||
|
cssUnderline: {
|
||
|
'&:after': {
|
||
|
backgroundColor: '#f7861c',
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
|
||
|
const TextField = props => {
|
||
|
const { error, classes, ...textFieldProps } = props
|
||
|
|
||
|
return (
|
||
|
<MaterialTextField
|
||
|
error={Boolean(error)}
|
||
|
helperText={error}
|
||
|
InputLabelProps={{
|
||
|
FormLabelClasses: {
|
||
|
root: classes.cssLabel,
|
||
|
focused: classes.cssFocused,
|
||
|
},
|
||
|
}}
|
||
|
InputProps={{
|
||
|
classes: {
|
||
|
underline: classes.cssUnderline,
|
||
|
},
|
||
|
}}
|
||
|
{...textFieldProps}
|
||
|
/>
|
||
|
)
|
||
|
}
|
||
|
|
||
|
TextField.defaultProps = {
|
||
|
error: null,
|
||
|
}
|
||
|
|
||
|
TextField.propTypes = {
|
||
|
error: PropTypes.string,
|
||
|
classes: PropTypes.object,
|
||
|
}
|
||
|
|
||
|
export default withStyles(styles)(TextField)
|