MCPcopy Create free account
hub / github.com/PageAI-Pro/page-ui / BrickCodeEditorToggle

Function BrickCodeEditorToggle

components/bricks/brick-code-toggle.tsx:23–68  ·  view source on GitHub ↗
({
  brick,
  demo,
}: {
  brick: string;
  demo: string;
})

Source from the content-addressed store, hash-verified

21);
22
23export const BrickCodeEditorToggle = ({
24 brick,
25 demo,
26}: {
27 brick: string;
28 demo: string;
29}) => {
30 const [open, setOpen] = useState(false);
31
32 const viewCode = () => {
33 setOpen(true);
34 };
35
36 return (
37 <Dialog open={open} onOpenChange={setOpen}>
38 <DialogTrigger asChild>
39 <Button size="icon" variant="outline" onClick={viewCode}>
40 <Code2Icon className="w-4 h-4" />
41 </Button>
42 </DialogTrigger>
43 <DialogContent className="md:max-w-md lg:max-w-2xl">
44 <DialogHeader>
45 <DialogTitle>Copy code</DialogTitle>
46 </DialogHeader>
47
48 <div className="overflow-auto">
49 <Suspense
50 fallback={
51 <div>
52 <Loader2Icon className="text-gray-500 h-4 w-4 animate-spin" />
53 </div>
54 }
55 >
56 <LazyBrickCodeEditor brick={brick} demo={demo} />
57 </Suspense>
58 </div>
59
60 <DialogFooter>
61 <DialogClose asChild>
62 <Button variant="outline">Done</Button>
63 </DialogClose>
64 </DialogFooter>
65 </DialogContent>
66 </Dialog>
67 );
68};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected