MCPcopy
hub / github.com/d3george/slash-admin / CodeBlock

Function CodeBlock

src/components/code/code-bock.tsx:9–33  ·  view source on GitHub ↗
({ title, description, children, code, options, className, ...props }: CodeBlockProps)

Source from the content-addressed store, hash-verified

7import { Icon } from "../icon";
8
9export function CodeBlock({ title, description, children, code, options, className, ...props }: CodeBlockProps) {
10 const [isOpen, setIsOpen] = useState(false);
11
12 return (
13 <Card className={cn("w-full", className)} {...props}>
14 <CardHeader>
15 <CardTitle>{title}</CardTitle>
16 <CardDescription>{description}</CardDescription>
17 </CardHeader>
18 <CardContent>{children}</CardContent>
19 <CardFooter className="flex items-center justify-between">
20 <Collapsible open={isOpen} onOpenChange={setIsOpen} className="flex flex-col gap-2 w-full">
21 <CollapsibleTrigger asChild>
22 <Button variant="ghost" size="icon" className="size-8 w-full">
23 <Icon icon="lucide:code-xml" size={20} />
24 </Button>
25 </CollapsibleTrigger>
26 <CollapsibleContent className="flex flex-col gap-2 w-full">
27 <HighlightCode code={code} options={options} />
28 </CollapsibleContent>
29 </Collapsible>
30 </CardFooter>
31 </Card>
32 );
33}

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected