Function
ComponentPreview
({
name,
className,
align = "center",
hideCode = false,
...props
}: ComponentPreviewProps)
Source from the content-addressed store, hash-verified
| 12 | } |
| 13 | |
| 14 | export function ComponentPreview({ |
| 15 | name, |
| 16 | className, |
| 17 | align = "center", |
| 18 | hideCode = false, |
| 19 | ...props |
| 20 | }: ComponentPreviewProps) { |
| 21 | const Component = Index[name]?.component; |
| 22 | const metaClassName = Index[name]?.meta?.className; |
| 23 | |
| 24 | if (!Component) { |
| 25 | return ( |
| 26 | <p className="text-muted-foreground text-sm"> |
| 27 | Component{" "} |
| 28 | <code className="relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-[.8125rem]"> |
| 29 | {name} |
| 30 | </code>{" "} |
| 31 | not found in registry. |
| 32 | </p> |
| 33 | ); |
| 34 | } |
| 35 | |
| 36 | return ( |
| 37 | <ComponentPreviewTabs |
| 38 | align={align} |
| 39 | className={cn(metaClassName, className)} |
| 40 | component={<Component />} |
| 41 | hideCode={hideCode} |
| 42 | source={<ComponentSource collapsible={false} name={name} />} |
| 43 | {...props} |
| 44 | /> |
| 45 | ); |
| 46 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected