-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split out visible checklist and exclusive checklist option
- Loading branch information
Showing
4 changed files
with
242 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
editor.planx.uk/src/@planx/components/Checklist/Public/components/ExclusiveChecklistItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import Grid from "@mui/material/Grid"; | ||
import Typography from "@mui/material/Typography"; | ||
import { FormikProps } from "formik"; | ||
import React from "react"; | ||
import FormWrapper from "ui/public/FormWrapper"; | ||
import ChecklistItem from "ui/shared/ChecklistItem/ChecklistItem"; | ||
|
||
import { Option } from "../../../shared"; | ||
|
||
export const ExclusiveChecklistItem = ({ | ||
exclusiveOrOption, | ||
changeCheckbox, | ||
formik, | ||
}: { | ||
exclusiveOrOption: Option; | ||
changeCheckbox: (id: string) => () => void; | ||
formik: FormikProps<{ checked: Array<string> }>; | ||
}) => ( | ||
<FormWrapper key={exclusiveOrOption.id}> | ||
<Grid item xs={12} key={exclusiveOrOption.data.text}> | ||
<Typography width={36} display="flex" justifyContent="center"> | ||
or | ||
</Typography> | ||
|
||
<ChecklistItem | ||
onChange={changeCheckbox(exclusiveOrOption.id)} | ||
label={exclusiveOrOption.data.text} | ||
id={exclusiveOrOption.id} | ||
checked={formik.values.checked.includes(exclusiveOrOption.id)} | ||
/> | ||
</Grid> | ||
</FormWrapper> | ||
); |
Oops, something went wrong.