import { FC } from "react";
import { Select as InternalSelect } from "@mui/material";

type SelectProps = {
  name: string;
  label: string;
  formState: Record<string, any>;
  children: React.ReactNode;
};

export const Select: FC<SelectProps> = ({
  name,
  label,
  formState,
  children,
}) => (
  <InternalSelect
    fullWidth
    name={name}
    label={label}
    variant="outlined"
    size="small"
    inputProps={{ id: name }}
    defaultValue={formState.values[name] || ""}
    sx={{
      backgroundColor: "#fff",
    }}
  >
    {children}
  </InternalSelect>
);
