Files
web/packages/design-system/lib/components/Typography/Typography.tsx
Michael Zetterberg 56973888c9 feat(SW-375): new tokens
new asset generation logic

BREAKING CHANGE: New tokens.
2025-03-07 07:24:37 +00:00

19 lines
452 B
TypeScript

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