Create/detail updates

This commit is contained in:
Darren Clarke 2024-04-24 21:44:05 +02:00
parent b0fb643b6a
commit 0997e449bb
26 changed files with 684 additions and 108 deletions

View file

@ -0,0 +1,38 @@
import { FC } from "react";
import { TextField as InternalTextField } from "@mui/material";
type TextFieldProps = {
name: string;
label: string;
formState: Record<string, any>;
required?: boolean;
lines?: number;
helperText?: string;
};
export const TextField: FC<TextFieldProps> = ({
name,
label,
formState,
required = false,
lines = 1,
helperText,
}) => (
<InternalTextField
fullWidth
name={name}
label={label}
size="small"
multiline={lines > 1}
rows={lines}
required={required}
defaultValue={formState.values[name]}
error={Boolean(formState.errors[name])}
helperText={formState.errors[name] ?? helperText}
InputProps={{
sx: {
backgroundColor: "#fff",
},
}}
/>
);