fix: hotjar - suppress personal data * fix: hotjar - suppress personal data * More suppressing
40 lines
790 B
TypeScript
40 lines
790 B
TypeScript
import { checkForEmptyChildren } from "../../utils/checkForEmptyChildren"
|
|
import { headingVariants } from "./variants"
|
|
|
|
import type { HeadingProps } from "./title"
|
|
|
|
export default function Title({
|
|
/**
|
|
* What styling to use, based on heading level. If not provided `level`
|
|
* will determine the styling.
|
|
*/
|
|
as,
|
|
children,
|
|
className = "",
|
|
color,
|
|
/**
|
|
* What HTML tag to use. Defaults to h1.
|
|
*/
|
|
level = "h1",
|
|
textAlign,
|
|
textTransform,
|
|
...rest
|
|
}: HeadingProps) {
|
|
if (checkForEmptyChildren(children) === 0) {
|
|
return null
|
|
}
|
|
const Hx = level
|
|
const classNames = headingVariants({
|
|
className,
|
|
color,
|
|
textAlign,
|
|
textTransform,
|
|
type: as ?? level,
|
|
})
|
|
return (
|
|
<Hx {...rest} className={classNames}>
|
|
{children}
|
|
</Hx>
|
|
)
|
|
}
|