Files
web/packages/design-system/lib/components/Typography/Typography.tsx
Rasmus Langvad d0546926a9 Merged in fix/3697-prettier-configs (pull request #3396)
fix(SW-3691): Setup one prettier config for whole repo

* Setup prettierrc in root and remove other configs


Approved-by: Joakim Jäderberg
Approved-by: Linus Flood
2026-01-07 12:45:50 +00:00

25 lines
512 B
TypeScript

import { cloneElement, isValidElement } from "react"
import { variants } from "./variants"
import type { TypographyProps } from "./types"
export function Typography({
variant,
className,
children,
}: TypographyProps): React.ReactNode {
if (!isValidElement(children)) return null
const classNames = variants({
variant,
})
return cloneElement(children, {
...children.props,
className: [className, children.props.className, classNames]
.filter(Boolean)
.join(" "),
})
}