Files
web/components/TempDesignSystem/Text/Title/index.tsx
2024-06-13 10:00:16 +02:00

28 lines
505 B
TypeScript

import { headingVariants } from "./variants"
import type { HeadingProps } from "./title"
export default function Title({
as,
children,
className = "",
color,
hideEmpty = true,
level = "h1",
textAlign,
textTransform,
}: HeadingProps) {
if (hideEmpty && !children) {
return null
}
const Hx = level
const classNames = headingVariants({
className,
color,
textAlign,
textTransform,
type: as ?? level,
})
return <Hx className={classNames}>{children}</Hx>
}