Skip to content

Commit

Permalink
fix(odyssey-react-mui): make Form, Infobox spacing constent across uses
Browse files Browse the repository at this point in the history
  • Loading branch information
edburyenegren-okta committed Jul 20, 2023
1 parent 91f1023 commit 752461c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
32 changes: 20 additions & 12 deletions packages/odyssey-react-mui/src/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,25 +117,33 @@ const Form = ({
padding: (theme) => theme.spacing(0),
}}
>
{title && (
<Typography variant="h4" component="h1">
{title}
</Typography>
)}
{description && (
<Typography component="p" variant="subtitle2">
{description}
</Typography>
)}
{alert}
{children}
<Box
component="div"
sx={{
marginBlockEnd: (theme) => theme.spacing(4),
}}
>
{title && (
<Typography variant="h4" component="h1">
{title}
</Typography>
)}
{description && (
<Typography component="p" variant="subtitle2">
{description}
</Typography>
)}
{alert}
</Box>
<Box component="div">{children}</Box>
{formActions && (
<Box
component="div"
sx={{
display: "flex",
justifyContent: "flex-start",
gap: (theme) => theme.spacing(1),
marginBlockStart: (theme) => theme.spacing(7),
}}
>
{formActions}
Expand Down
4 changes: 2 additions & 2 deletions packages/odyssey-react-mui/src/Infobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import { memo, ReactNode } from "react";
import { Alert, AlertTitle } from "@mui/material";
import { Alert, AlertTitle, Box } from "@mui/material";
import { ScreenReaderText } from "./ScreenReaderText";
import { useTranslation } from "react-i18next";

Expand Down Expand Up @@ -51,7 +51,7 @@ const Infobox = ({ children, role, severity, title }: InfoboxProps) => {
<Alert role={role} severity={severity} variant="infobox">
<ScreenReaderText>{t(`severity.${severity}`)}: </ScreenReaderText>
{title && <AlertTitle>{title}</AlertTitle>}
{children}
<Box component="div">{children}</Box>
</Alert>
);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/theme/typography.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const typography = (
fontVariant: "normal",
lineHeight: odysseyTokens.TypographyLineHeightBody,
letterSpacing: "initial",
marginBlockEnd: odysseyTokens.Spacing5,
marginBlockEnd: odysseyTokens.Spacing4,
},
body1: {
color: odysseyTokens.TypographyColorBody,
Expand Down

0 comments on commit 752461c

Please sign in to comment.