adminFront/src/kitUI/CustomTextField.tsx

39 lines
1.1 KiB
TypeScript
Raw Normal View History

2023-05-24 16:27:10 +00:00
import { SxProps, TextField, Theme, useTheme } from "@mui/material";
2023-05-23 12:20:37 +00:00
import { HTMLInputTypeAttribute, ChangeEvent } from "react";
2023-05-24 16:27:10 +00:00
export function CustomTextField({ id, label, value, type, sx, onChange: setValue }: {
2023-05-23 12:20:37 +00:00
id: string;
label: string;
value: number | string | null;
type?: HTMLInputTypeAttribute;
2023-05-24 16:27:10 +00:00
sx?: SxProps<Theme>;
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
2023-05-23 12:20:37 +00:00
}) {
const theme = useTheme();
return (
<TextField
fullWidth
id={id}
label={label}
variant="filled"
color="secondary"
type={type}
2023-05-24 16:27:10 +00:00
sx={sx}
2023-05-23 12:20:37 +00:00
InputProps={{
style: {
backgroundColor: theme.palette.content.main,
color: theme.palette.secondary.main,
}
}}
InputLabelProps={{
style: {
color: theme.palette.secondary.main
}
}}
value={value ? value : ""}
onChange={setValue}
/>
);
}