Files
web/components/TempDesignSystem/Text/Title/index.tsx
2024-06-18 16:21:43 +02:00

28 lines
574 B
TypeScript

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