Refactoring 2
This commit is contained in:
parent
dd14dfe72e
commit
e4b78ceec2
76 changed files with 870 additions and 734 deletions
|
|
@ -12,6 +12,7 @@ type SelectProps = {
|
|||
formState: Record<string, any>;
|
||||
required?: boolean;
|
||||
getOptions?: (formState: any) => Promise<SelectOption[]>;
|
||||
updateFormState?: (field: string, value: any) => void;
|
||||
};
|
||||
|
||||
export const Select: FC<SelectProps> = ({
|
||||
|
|
@ -20,6 +21,7 @@ export const Select: FC<SelectProps> = ({
|
|||
formState,
|
||||
required = false,
|
||||
getOptions,
|
||||
updateFormState,
|
||||
}) => {
|
||||
const [options, setOptions] = useState([] as SelectOption[]);
|
||||
|
||||
|
|
@ -42,7 +44,8 @@ export const Select: FC<SelectProps> = ({
|
|||
required={required}
|
||||
size="small"
|
||||
inputProps={{ id: name }}
|
||||
defaultValue={formState.values[name] || ""}
|
||||
value={formState.values[name] || ""}
|
||||
onChange={(e: any) => updateFormState?.(name, e.target.value)}
|
||||
sx={{
|
||||
backgroundColor: "#fff",
|
||||
}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue