2023-03-18 15:52:18 +00:00
|
|
|
import {
|
|
|
|
FormControl,
|
|
|
|
InputLabel,
|
|
|
|
SxProps,
|
|
|
|
TextField,
|
|
|
|
TextFieldProps,
|
|
|
|
Theme,
|
|
|
|
useMediaQuery,
|
|
|
|
useTheme,
|
|
|
|
} from "@mui/material";
|
2022-11-19 20:31:42 +00:00
|
|
|
|
|
|
|
interface Props {
|
2023-03-18 15:52:18 +00:00
|
|
|
id: string;
|
|
|
|
label?: string;
|
|
|
|
bold?: boolean;
|
|
|
|
gap?: string;
|
|
|
|
color?: string;
|
|
|
|
FormInputSx?: SxProps<Theme>;
|
|
|
|
TextfieldProps: TextFieldProps;
|
|
|
|
onChange: (e: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) => void;
|
2022-11-19 20:31:42 +00:00
|
|
|
}
|
|
|
|
|
2023-03-18 15:52:18 +00:00
|
|
|
export default function InputTextfield({
|
|
|
|
id,
|
|
|
|
label,
|
|
|
|
bold = false,
|
|
|
|
gap = "10px",
|
|
|
|
onChange,
|
|
|
|
TextfieldProps,
|
|
|
|
color,
|
|
|
|
FormInputSx,
|
|
|
|
}: Props) {
|
|
|
|
const theme = useTheme();
|
|
|
|
const upMd = useMediaQuery(theme.breakpoints.up("md"));
|
2022-11-19 20:31:42 +00:00
|
|
|
|
2023-03-18 15:52:18 +00:00
|
|
|
const labelFont = upMd
|
|
|
|
? bold
|
|
|
|
? theme.typography.p1
|
|
|
|
: { ...theme.typography.body1, fontWeight: 500 }
|
|
|
|
: theme.typography.body2;
|
2022-11-25 18:50:37 +00:00
|
|
|
|
2023-03-18 15:52:18 +00:00
|
|
|
const placeholderFont = upMd ? undefined : { fontWeight: 400, fontSize: "16px", lineHeight: "19px" };
|
2022-11-19 20:31:42 +00:00
|
|
|
|
2023-03-18 15:52:18 +00:00
|
|
|
return (
|
|
|
|
<FormControl
|
|
|
|
fullWidth
|
|
|
|
variant="standard"
|
|
|
|
sx={{
|
|
|
|
gap,
|
2023-03-27 13:04:09 +00:00
|
|
|
// mt: "10px",
|
2023-03-18 15:52:18 +00:00
|
|
|
...FormInputSx,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<InputLabel
|
|
|
|
shrink
|
|
|
|
htmlFor={id}
|
|
|
|
sx={{
|
|
|
|
position: "inherit",
|
|
|
|
color: "black",
|
|
|
|
transform: "none",
|
|
|
|
...labelFont,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{label}
|
|
|
|
</InputLabel>
|
|
|
|
<TextField
|
|
|
|
{...TextfieldProps}
|
|
|
|
fullWidth
|
|
|
|
id={id}
|
|
|
|
sx={{
|
|
|
|
"& .MuiInputBase-root": {
|
|
|
|
height: "48px",
|
|
|
|
borderRadius: "8px",
|
|
|
|
},
|
|
|
|
}}
|
|
|
|
inputProps={{
|
|
|
|
sx: {
|
|
|
|
backgroundColor: color,
|
|
|
|
borderRadius: "8px",
|
|
|
|
height: "48px",
|
|
|
|
py: 0,
|
2023-05-13 14:13:57 +00:00
|
|
|
color: "black",
|
2023-03-18 15:52:18 +00:00
|
|
|
...placeholderFont,
|
|
|
|
},
|
|
|
|
}}
|
|
|
|
onChange={onChange}
|
|
|
|
/>
|
|
|
|
</FormControl>
|
|
|
|
);
|
|
|
|
}
|