Skip to content

Commit

Permalink
Fix warning of props being passed to DOM
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Fichtner committed Dec 10, 2024
1 parent 626c019 commit 494f48f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions site/src/common/components/Typography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,15 @@ const variantToElementMap: Record<TypographyVariant, "h1" | "h2" | "h3" | "h4" |
p200: "p",
};

export const Typography = styled.div.attrs<{
as?: unknown;
variant?: TypographyVariant;
bottomSpacing?: boolean;
}>((props) => ({ as: props.as ?? variantToElementMap[props.variant ?? "p300"] }))`
export const Typography = styled.div
.withConfig({
shouldForwardProp: (prop) => !["variant", "bottomSpacing"].includes(prop),
})
.attrs<{
as?: unknown;
variant?: TypographyVariant;
bottomSpacing?: boolean;
}>((props) => ({ as: props.as ?? variantToElementMap[props.variant ?? "p300"] }))`
font-family: ${({ theme }) => theme.fontFamily};
${({ variant = "p300" }) => typographyVariantStyle[variant]};
margin-top: 0;
Expand Down

0 comments on commit 494f48f

Please sign in to comment.