MCPcopy Create free account
hub / github.com/SyntaxUI/syntaxui / PreviewCodeGroup

Function PreviewCodeGroup

src/components/code/PreviewCodeGroup.tsx:19–55  ·  view source on GitHub ↗
({
  code,
  language,
  preview,
}: {
  code: string
  language: string
  preview: React.ReactNode
})

Source from the content-addressed store, hash-verified

17 * @example view `src/app/docs/animations/hovers/jiggle/page.mdx`
18 */
19export default function PreviewCodeGroup({
20 code,
21 language,
22 preview,
23}: {
24 code: string
25 language: string
26 preview: React.ReactNode
27}) {
28 const [activeTab, setActiveTab] = useState('preview')
29
30 return (
31 <div className="flex w-full flex-col ">
32 <div className="ml-auto w-fit">
33 <Tabs
34 tabs={[
35 {
36 id: 'preview',
37 label: 'Preview',
38 },
39 {
40 id: 'code',
41 label: 'Code',
42 },
43 ]}
44 activeTab={activeTab}
45 onTabClick={setActiveTab}
46 />
47 </div>
48 {activeTab === 'preview' ? (
49 <div className="rounded-2xl border p-6">{preview}</div>
50 ) : (
51 <Code code={code} language={language} />
52 )}
53 </div>
54 )
55}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected