Skip to content

Commit

Permalink
fix: revert #2013 (#2029)
Browse files Browse the repository at this point in the history
This reverts commit 4ae50de.
  • Loading branch information
KevinGhadyani-Okta authored Nov 2, 2023
1 parent c19d1e6 commit 9f75603
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 40 deletions.
40 changes: 11 additions & 29 deletions packages/odyssey-react-mui/src/Typography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ import {
Typography as MuiTypography,
TypographyProps as MuiTypographyProps,
} from "@mui/material";
import { ElementType, ReactNode, memo, useCallback, useMemo } from "react";
import { ElementType, ReactNode, memo, useMemo } from "react";
import { SeleniumProps } from "./SeleniumProps";
import { MuiPropsContext } from "./MuiPropsContext";

export type TypographyVariantValue =
| "h1"
Expand Down Expand Up @@ -108,34 +107,17 @@ const Typography = ({
return componentProp;
}, [componentProp, variant]);

const renderTypography = useCallback(
(muiProps) => (
<MuiTypography
{...muiProps}
aria-describedby={ariaDescribedBy}
aria-label={ariaLabel}
aria-labelledby={ariaLabelledBy}
children={children}
color={color}
component={component}
data-se={testId}
variant={typographyVariantMapping[variant]}
/>
),
[
ariaDescribedBy,
ariaLabel,
ariaLabelledBy,
children,
color,
component,
testId,
variant,
]
);

return (
<MuiPropsContext.Consumer>{renderTypography}</MuiPropsContext.Consumer>
<MuiTypography
aria-describedby={ariaDescribedBy}
aria-label={ariaLabel}
aria-labelledby={ariaLabelledBy}
children={children}
color={color}
component={component}
data-se={testId}
variant={typographyVariantMapping[variant]}
/>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import { Meta, StoryObj } from "@storybook/react";
import {
Button,
Paragraph,
Status,
Tag,
Tooltip,
Expand Down Expand Up @@ -148,16 +147,6 @@ export const IconButton: StoryObj<TooltipProps> = {
},
};

export const ParagraphWrapper: StoryObj<TooltipProps> = {
...Template,
args: {
children: <Paragraph children="This is body copy." variant="body" />,
ariaType: "label",
placement: "top",
text: "This is a tooltip on body copy.",
},
};

export const StatusWrapper: StoryObj<TooltipProps> = {
...Template,
args: {
Expand Down

0 comments on commit 9f75603

Please sign in to comment.