Files
web/components/TempDesignSystem/Text/Title/index.tsx

30 lines
560 B
TypeScript

import { Children } from "react"
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.count(children) === 0) {
return null
}
const Hx = level
const classNames = headingVariants({
className,
color,
textAlign,
textTransform,
type: as ?? level,
})
return <Hx className={classNames}>{children}</Hx>
}