fix: filter out empty children
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Slot } from "@radix-ui/react-slot"
|
||||
import { Children } from "react"
|
||||
|
||||
import { checkForEmptyChildren } from "../../utils/checkForEmptyChildren"
|
||||
import { subtitleVariants } from "./variants"
|
||||
|
||||
import type { SubtitleProps } from "./subtitle"
|
||||
@@ -13,7 +13,7 @@ export default function Subtitle({
|
||||
textTransform,
|
||||
...props
|
||||
}: SubtitleProps) {
|
||||
if (Children.toArray(props.children).length === 0) {
|
||||
if (checkForEmptyChildren(props.children) === 0) {
|
||||
return null
|
||||
}
|
||||
const Comp = asChild ? Slot : "p"
|
||||
|
||||
Reference in New Issue
Block a user