Skip to content

Commit

Permalink
alter ServiceSection to include background boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 committed Oct 1, 2024
1 parent 92950bc commit 1f0744b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions editor.planx.uk/src/ui/editor/SettingsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { styled } from "@mui/material/styles";
import { contentFlowSpacing } from "@planx/components/shared/Preview/Card";
import React, { ReactNode } from "react";

const Root = styled(Box)(({ bgcolor, theme }) => ({
const Root = styled(Box, {
shouldForwardProp: (prop) => prop !== "background",
})<BoxProps & { background?: boolean }>(({ background, theme }) => ({
display: "block",
width: "100%",
marginTop: theme.spacing(2),
Expand All @@ -14,7 +16,7 @@ const Root = styled(Box)(({ bgcolor, theme }) => ({
"& > * + *, & > form > * + *": {
...contentFlowSpacing(theme),
},
...(bgcolor && {
...(background && {
background: theme.palette.background.paper,
marginTop: theme.spacing(2),
padding: theme.spacing(2.5),
Expand All @@ -23,7 +25,7 @@ const Root = styled(Box)(({ bgcolor, theme }) => ({
}));

export default function SettingsSection(
props: { children: ReactNode } & Partial<BoxProps>,
props: { children: ReactNode; background?: boolean } & Partial<BoxProps>,
) {
return <Root {...props}>{props.children}</Root>;
}

0 comments on commit 1f0744b

Please sign in to comment.