Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap Typography #1886

Merged
merged 10 commits into from
Jul 21, 2023
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
Checkbox as MuiCheckbox,
CheckboxProps as MuiCheckboxProps,
FormControlLabel,
Typography,
} from "@mui/material";
import { Typography } from "./Typography";
import { memo, useCallback, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";

Expand Down
2 changes: 1 addition & 1 deletion packages/odyssey-react-mui/src/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import { memo, ReactElement, useMemo } from "react";
import {
FormControl as MuiFormControl,
FormLabel as MuiFormLabel,
Typography,
} from "@mui/material";
import { FieldError } from "./FieldError";
import { FieldHint } from "./FieldHint";
import { FieldLabel } from "./FieldLabel";
import { Typography } from "./Typography";
import { useUniqueId } from "./useUniqueId";
import { useTranslation } from "react-i18next";

Expand Down
6 changes: 2 additions & 4 deletions packages/odyssey-react-mui/src/FieldLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { memo, useMemo } from "react";

import { useTranslation } from "react-i18next";
import { ScreenReaderText } from "./ScreenReaderText";
import { Typography } from "@mui/material";
import { Subordinate } from "./Typography";

export type FieldLabelProps = {
hasVisibleLabel: boolean;
Expand All @@ -39,9 +39,7 @@ const FieldLabel = ({
<MuiInputLabel htmlFor={inputId} id={id}>
<span>{text}</span>
{isOptional && (
<Typography variant="subtitle1">
{t("fieldlabel.optional.text")}
</Typography>
<Subordinate>{t("fieldlabel.optional.text")}</Subordinate>
)}
</MuiInputLabel>
),
Expand Down
13 changes: 4 additions & 9 deletions packages/odyssey-react-mui/src/Fieldset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@

import { memo, ReactElement } from "react";

import { Box, Typography } from "@mui/material";
import { Box } from "@mui/material";
import { Infobox } from "./Infobox";
import { Legend, Subordinate } from "./Typography";
import { useUniqueId } from "./useUniqueId";

export type FieldsetProps = {
Expand Down Expand Up @@ -71,14 +72,8 @@ const Fieldset = ({
},
}}
>
<Typography variant="legend" component="legend">
{legend}
</Typography>
{description && (
<Typography component="p" variant="subtitle2">
{description}
</Typography>
)}
<Legend>{legend}</Legend>
{description && <Subordinate component="p">{description}</Subordinate>}
{alert}
{children}
</Box>
Expand Down
15 changes: 4 additions & 11 deletions packages/odyssey-react-mui/src/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@

import { memo, ReactElement } from "react";

import { Box, Typography } from "@mui/material";
import { Box } from "@mui/material";
import { Button } from "./Button";
import { Infobox } from "./Infobox";
import { Heading4, Support } from "./Typography";
import { useUniqueId } from "./useUniqueId";

export const formEncodingTypeValues = [
Expand Down Expand Up @@ -123,16 +124,8 @@ const Form = ({
marginBlockEnd: (theme) => theme.spacing(4),
}}
>
{title && (
<Typography variant="h4" component="h1">
{title}
</Typography>
)}
{description && (
<Typography component="p" variant="subtitle2">
{description}
</Typography>
)}
{title && <Heading4 component="h1">{title}</Heading4>}
{description && <Support>{description}</Support>}
{alert}
</Box>
<Box component="div">{children}</Box>
Expand Down
Loading