30 lines
643 B
TypeScript
30 lines
643 B
TypeScript
import { Slot } from "@radix-ui/react-slot"
|
|
|
|
import { checkForEmptyChildren } from "../../utils/checkForEmptyChildren"
|
|
import { subtitleVariants } from "./variants"
|
|
|
|
import type { SubtitleProps } from "./subtitle"
|
|
|
|
export default function Subtitle({
|
|
asChild = false,
|
|
className = "",
|
|
color,
|
|
textAlign,
|
|
textTransform,
|
|
type,
|
|
...props
|
|
}: SubtitleProps) {
|
|
if (checkForEmptyChildren(props.children) === 0) {
|
|
return null
|
|
}
|
|
const Comp = asChild ? Slot : "p"
|
|
const classNames = subtitleVariants({
|
|
className,
|
|
color,
|
|
textAlign,
|
|
textTransform,
|
|
type,
|
|
})
|
|
return <Comp className={classNames} {...props} />
|
|
}
|