import React, { useState } from "react"; import { makeStyles } from "@material-ui/core/styles"; import FormLabel from "@material-ui/core/FormLabel"; import FormControl from "@material-ui/core/FormControl"; import FormGroup from "@material-ui/core/FormGroup"; import FormControlLabel from "@material-ui/core/FormControlLabel"; import Checkbox from "@material-ui/core/Checkbox"; import FormHelperText from "@material-ui/core/FormHelperText"; const useStyles = makeStyles((theme) => ({ root: { "& .MuiFormLabel-root": { color: "#d68000", marginBottom: theme.spacing(2), marginLeft: "auto", marginRight: "auto", fontWeight: "500" }, "& .MuiFormHelperText-root": { color: "#7e7e7e", }, "& .MuiFormGroup-root": { display: "inline", }, border: "1px solid #1c1c1c", borderRadius: "6px", marginBottom: theme.spacing(2), }, formControl: { margin: theme.spacing(2), alignItems: "center", }, })); export default function Checkboxes(props) { const classes = useStyles(); const initialState = { gluten: props.allergens.gluten, lactose: props.allergens.lactose, soy: props.allergens.soy, eggs: props.allergens.eggs, seaFood: props.allergens.seaFood, peanuts: props.allergens.peanuts, sesame: props.allergens.sesame, }; const [state, setState] = useState(initialState); return (