14990: added 404 page with wildcard route
[arvados-workbench2.git] / src / components / text-field / text-field.tsx
index 0aeaeb85f663ccb3394965b4ff5dff21912e13ee..1cf9a81d28b497817bf3720f6f53550dea539872 100644 (file)
@@ -15,24 +15,36 @@ import {
 import RichTextEditor from 'react-rte';
 import Margin = PropTypes.Margin;
 
-type CssRules = 'textField';
+type CssRules = 'textField' | 'rte';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     textField: {
-        marginBottom: theme.spacing.unit * 3
+        marginBottom: theme.spacing.unit
     },
+    rte: {
+        fontFamily: 'Arial',
+        '& a': {
+            textDecoration: 'none',
+            color: theme.palette.primary.main,
+            '&:hover': {
+                cursor: 'pointer',
+                textDecoration: 'underline'
+            }
+        }
+    }
 });
 
 type TextFieldProps = WrappedFieldProps & WithStyles<CssRules>;
 
 export const TextField = withStyles(styles)((props: TextFieldProps & {
-    label?: string, autoFocus?: boolean, required?: boolean, select?: boolean, children: React.ReactNode, margin?: Margin
+    label?: string, autoFocus?: boolean, required?: boolean, select?: boolean, disabled?: boolean, children: React.ReactNode, margin?: Margin, placeholder?: string,
+    helperText?: string, type?: string,
 }) =>
     <MaterialTextField
-        helperText={props.meta.touched && props.meta.error}
+        helperText={(props.meta.touched && props.meta.error) || props.helperText}
         className={props.classes.textField}
         label={props.label}
-        disabled={props.meta.submitting}
+        disabled={props.disabled || props.meta.submitting}
         error={props.meta.touched && !!props.meta.error}
         autoComplete='off'
         autoFocus={props.autoFocus}
@@ -41,6 +53,8 @@ export const TextField = withStyles(styles)((props: TextFieldProps & {
         select={props.select}
         children={props.children}
         margin={props.margin}
+        placeholder={props.placeholder}
+        type={props.type}
         {...props.input}
     />);
 
@@ -64,6 +78,7 @@ export const RichEditorTextField = withStyles(styles)(
 
         render() {
             return <RichTextEditor
+                className={this.props.classes.rte}
                 value={this.state.value}
                 onChange={this.onChange}
                 placeholder={this.props.label} />;