mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-26 22:26:05 +00:00
21 lines
456 B
TypeScript
21 lines
456 B
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
|
|
import { useConfig } from "@/hooks/use-config"
|
|
import { Style } from "@/registry/registry-styles"
|
|
|
|
interface StyleWrapperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
styleName?: Style["name"]
|
|
}
|
|
|
|
export function StyleWrapper({ styleName, children }: StyleWrapperProps) {
|
|
const [config] = useConfig()
|
|
|
|
if (!styleName || config.style === styleName) {
|
|
return <>{children}</>
|
|
}
|
|
|
|
return null
|
|
}
|