2019-11-19 06:37:36 +07:00
|
|
|
import React from "react";
|
|
|
|
import TextField, { TextFieldProps } from "@material-ui/core/TextField";
|
|
|
|
import { makeStyles } from "@material-ui/core";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This component fixes outlined TextField
|
|
|
|
* https://github.com/mui-org/material-ui/issues/14530#issuecomment-463576879
|
|
|
|
*
|
|
|
|
* @param props the TextField props
|
|
|
|
*/
|
2020-11-07 09:06:18 +07:00
|
|
|
const FixedTextField = function (props: TextFieldProps) {
|
2019-11-19 06:37:36 +07:00
|
|
|
const style = useStyles();
|
|
|
|
return (
|
|
|
|
<TextField {...props}
|
|
|
|
InputLabelProps={{
|
|
|
|
classes: {
|
|
|
|
root: style.label
|
|
|
|
}
|
2020-11-09 10:04:44 +07:00
|
|
|
}}
|
|
|
|
inputProps={{autoCapitalize: props.autoCapitalize}}>
|
2019-11-19 06:37:36 +07:00
|
|
|
{props.children}
|
|
|
|
</TextField>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-11-07 09:06:18 +07:00
|
|
|
export default FixedTextField
|
|
|
|
|
2019-11-19 06:37:36 +07:00
|
|
|
const useStyles = makeStyles(theme => ({
|
|
|
|
label: {
|
|
|
|
backgroundColor: theme.palette.background.default,
|
|
|
|
paddingLeft: theme.spacing(0.1),
|
|
|
|
paddingRight: theme.spacing(0.1),
|
|
|
|
}
|
|
|
|
}));
|