'use client' import { ChevronLeft, ChevronRight, Code, Eye } from 'lucide-react' import { useState } from 'react' import { Button } from 'ui' import { CodeBlock } from 'ui-patterns/CodeBlock' import SandpackWrapper from './sandpack' export type ExampleLayoutProps = { appJsCode: string files: Record dependencies?: Record title?: string description?: string onPrevious?: () => void onNext?: () => void } export default function ExampleLayout({ appJsCode, files, dependencies = {}, title = 'App.js', description = 'This is an example of a realtime app.', onPrevious, onNext, }: ExampleLayoutProps) { const [viewMode, setViewMode] = useState<'code' | 'preview'>('preview') const formattedCode = `// # ${title} // ${description} ${appJsCode}` return (
{/* Header Bar */}
{/* Left side: Code/Preview Toggle */}
{/* Center: Title */}
{title}
{/* Right: Navigation */}
{viewMode === 'preview' ? ( /* Previews - shown when in preview mode */
) : ( /* Code view - shown when in code mode */ {formattedCode} )}
) }