aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/text-field/text-field.component.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/text-field/text-field.component.js')
-rw-r--r--ui/app/components/text-field/text-field.component.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/ui/app/components/text-field/text-field.component.js b/ui/app/components/text-field/text-field.component.js
new file mode 100644
index 000000000..4a02f76d8
--- /dev/null
+++ b/ui/app/components/text-field/text-field.component.js
@@ -0,0 +1,54 @@
+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)