forked from bots-garden/ori
| ✨ Workspace panel, selectors, previews, desktop app, sandbox template, resizable file tree, light/dark theme | 1 | /** |
| 2 | * CodeView shows read-only source code with Monaco's syntax highlighting, | |
| 3 | * lazy-loading Monaco on first use. | |
| 4 | * | |
| 5 | * @example | |
| 6 | * <CodeView content="package main" language="go" /> | |
| 7 | */ | |
| 8 | ||
| 9 | import { lazy, Suspense } from "react"; | |
| 10 | ||
| 11 | const MonacoViewer = lazy(() => import("./MonacoViewer")); | |
| 12 | ||
| 13 | export function CodeView({ | |
| 14 | content, | |
| 15 | language, | |
| 16 | }: { content: string; language: string }) { | |
| 17 | return ( | |
| 18 | <Suspense fallback={<p className="pane-empty">loading viewer…</p>}> | |
| 19 | <MonacoViewer content={content} language={language} readOnly /> | |
| 20 | </Suspense> | |
| 21 | ); | |
| 22 | } |