Skip to content

Commit a186837

Browse files
committed
wip
1 parent 452097c commit a186837

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

app/share/[id]/code-viewer.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,39 @@ import {
66
} from "@codesandbox/sandpack-react/unstyled";
77
import { dracula as draculaTheme } from "@codesandbox/sandpack-themes";
88

9+
// TODO: Add shadcn components + library (recharts, lucide-react)
910
export default function CodeViewer({ code }: { code: string }) {
1011
return (
1112
<SandpackProvider
1213
template="react-ts"
1314
theme={draculaTheme}
1415
files={{
1516
"App.tsx": code,
17+
"/public/index.html": `
18+
<!DOCTYPE html>
19+
<html lang="en">
20+
<head>
21+
<meta charset="UTF-8">
22+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
23+
<title>Document</title>
24+
<script src="https://cdn.tailwindcss.com"></script>
25+
</head>
26+
<body>
27+
<div id="root"></div>
28+
</body>
29+
</html>`,
1630
}}
1731
options={{
1832
externalResources: [
1933
"https://unpkg.com/@tailwindcss/ui/dist/tailwind-ui.min.css",
2034
],
2135
}}
36+
customSetup={{
37+
dependencies: {
38+
"lucide-react": "latest",
39+
recharts: "2.9.0",
40+
},
41+
}}
2242
>
2343
<SandpackPreview
2444
showOpenInCodeSandbox={false}

app/share/[id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ async function getCode(id: string) {
1111
Database schemahttp://localhost:3000/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fhalo.c1bc0835.png&w=3840&q=75
1212
1313
id (@uuid) | model (TEXT) | prompt (TEXT) | code (TEXT) | createdAt (auto datetime)
14-
-------------------------------------------------------------------------------------
14+
-------------------------------------------------------------------------------------
1515
abkens | llama-405b | Build me a.... | function.... | now()
1616
islkns | llama-405b | Build me a.... | function.... | now()
1717

0 commit comments

Comments
 (0)