1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { WrappedFieldProps } from 'redux-form';
7 import { ArvadosTheme } from '~/common/custom-theme';
8 import { TextField as MaterialTextField, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
10 type CssRules = 'textField';
12 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
14 marginBottom: theme.spacing.unit * 3
18 export const TextField = withStyles(styles)((props: WrappedFieldProps & WithStyles<CssRules> & { label?: string }) =>
20 helperText={props.meta.touched && props.meta.error}
21 className={props.classes.textField}
23 disabled={props.meta.submitting}
24 error={props.meta.touched && !!props.meta.error}