diff --git a/.changeset/four-terms-hope.md b/.changeset/four-terms-hope.md new file mode 100644 index 0000000000..7335535ec4 --- /dev/null +++ b/.changeset/four-terms-hope.md @@ -0,0 +1,12 @@ +--- +"@comet/admin-theme": minor +--- + +Add support and styling for full screen dialogs using the `fullScreen` prop + +```tsx + + Dialog Title + Dialog content + +``` diff --git a/packages/admin/admin-theme/src/componentsTheme/MuiDialog.ts b/packages/admin/admin-theme/src/componentsTheme/MuiDialog.ts index a5cc9e8cd2..d9b2464c33 100644 --- a/packages/admin/admin-theme/src/componentsTheme/MuiDialog.ts +++ b/packages/admin/admin-theme/src/componentsTheme/MuiDialog.ts @@ -32,5 +32,10 @@ export const getMuiDialog: GetMuiComponentTheme<"MuiDialog"> = (component, { spa paperFullWidth: { width: `calc(100% - ${spacing(16)})`, }, + paperFullScreen: { + borderRadius: 0, + maxWidth: "none", + margin: 0, + }, }), }); diff --git a/storybook/src/admin/mui/Dialog.stories.tsx b/storybook/src/admin/mui/Dialog.stories.tsx index 4cfce72be2..3a11d7c31c 100644 --- a/storybook/src/admin/mui/Dialog.stories.tsx +++ b/storybook/src/admin/mui/Dialog.stories.tsx @@ -1,9 +1,9 @@ -import { CancelButton, Dialog, Field, FinalFormCheckbox, FinalFormInput, FinalFormSelect, OkayButton } from "@comet/admin"; +import { CancelButton, CheckboxField, Dialog, OkayButton, SelectField, TextField } from "@comet/admin"; import { Save } from "@comet/admin-icons"; -import { Button, DialogActions, DialogContent, DialogContentText, DialogProps, FormControlLabel, MenuItem } from "@mui/material"; +import { Button, DialogActions, DialogContent, DialogContentText, DialogProps } from "@mui/material"; import { Form } from "react-final-form"; -type DialogSize = Exclude | "fullWidth"; +type DialogSize = Exclude | "fullWidth" | "fullScreen"; type DialogSizeOptions = { [label: string]: DialogSize; @@ -16,6 +16,7 @@ const dialogSizeOptions: DialogSizeOptions = { "LG (1280px)": "lg", "XL (1920px)": "xl", FullWidth: "fullWidth", + FullScreen: "fullScreen", }; const selectOptions = [ @@ -74,12 +75,12 @@ export const _Dialog = { render={({ handleSubmit }) => (
console.log("Dialog closed") : undefined} open={true} fullWidth={selectedDialogSize === "fullWidth"} - maxWidth={selectedDialogSize !== "fullWidth" && selectedDialogSize} + fullScreen={selectedDialogSize === "fullScreen"} + maxWidth={selectedDialogSize !== "fullWidth" && selectedDialogSize !== "fullScreen" && selectedDialogSize} > <>{selectedDialogSize === "xs" ? : } @@ -108,21 +109,9 @@ function DefaultDialogContent() { Lorem ipsum nullam quis risus eget urna mollis ornare vel eu leo. Nullam id dolor id nibh ultricies vehicula ut id elit. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Curabitur blandit tempus porttitor. - - - {(props) => ( - - {selectOptions.map((option) => ( - - {option.label} - - ))} - - )} - - - {(props) => } />} - + + +