forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiframe-switcher.tsx
More file actions
46 lines (43 loc) · 1.12 KB
/
Copy pathiframe-switcher.tsx
File metadata and controls
46 lines (43 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"use client";
import { Tabs, Tab } from "../docs-tabs";
interface IframeSwitcherProps {
id?: string;
exampleUrl: string;
codeUrl: string;
exampleLabel?: string;
codeLabel?: string;
height?: string;
}
export function IframeSwitcher({
id,
exampleUrl,
codeUrl,
exampleLabel = "Demo",
codeLabel = "Code",
height = "600px",
}: IframeSwitcherProps) {
return (
<div id={id}>
<Tabs items={[exampleLabel, codeLabel]}>
<Tab value={exampleLabel}>
<iframe
src={exampleUrl}
className="shell-docs-radius-surface w-full border-0 bg-[var(--bg-surface)]"
style={{ height }}
sandbox="allow-scripts allow-same-origin allow-forms allow-popups"
loading="lazy"
/>
</Tab>
<Tab value={codeLabel}>
<iframe
src={codeUrl}
className="shell-docs-radius-surface w-full border-0 bg-[var(--bg-surface)]"
style={{ height }}
sandbox="allow-scripts allow-same-origin allow-forms allow-popups"
loading="lazy"
/>
</Tab>
</Tabs>
</div>
);
}