Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 3c18528

Browse files
committed
Added code block preview
1 parent 315b027 commit 3c18528

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

app/page.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
import React, { useRef, useState } from "react"
44
import { Loader2 } from "lucide-react"
55
import { Configuration, OpenAIApi } from "openai"
6+
import { CodeBlock, sunburst } from "react-code-blocks"
67

7-
import { siteConfig } from "@/config/site"
8-
import { Button, buttonVariants } from "@/components/ui/button"
8+
import { Button } from "@/components/ui/button"
99
import { Input } from "@/components/ui/input"
1010
import {
1111
Select,
1212
SelectContent,
13-
SelectGroup,
1413
SelectItem,
15-
SelectLabel,
1614
SelectTrigger,
1715
SelectValue,
1816
} from "@/components/ui/select"
@@ -101,11 +99,15 @@ export default function IndexPage() {
10199
<TabsTrigger value="preview">Preview</TabsTrigger>
102100
</TabsList>
103101
<TabsContent value="code" className="h-full w-full">
104-
<Textarea
105-
id="codetxt"
106-
placeholder="Code will be shown here"
107-
value={md}
108-
/>
102+
<div style={{ fontFamily: "consolas" }}>
103+
<CodeBlock
104+
text={md}
105+
language="markdown"
106+
wrapLines
107+
showLineNumbers={false}
108+
theme={sunburst}
109+
/>
110+
</div>
109111
<div
110112
className={
111113
sent

0 commit comments

Comments
 (0)