This repository was archived by the owner on Nov 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 11"use client"
22
33import React , { useRef , useState } from "react"
4+ import dynamic from "next/dynamic"
5+ import { MarkdownPreviewProps } from "@uiw/react-markdown-preview"
46import { Loader2 } from "lucide-react"
57import { Configuration , OpenAIApi } from "openai"
68import { CodeBlock , sunburst } from "react-code-blocks"
@@ -17,6 +19,13 @@ import {
1719import { Tabs , TabsContent , TabsList , TabsTrigger } from "@/components/ui/tabs"
1820import { Textarea } from "@/components/ui/textarea"
1921
22+ const MarkdownPreview = dynamic < MarkdownPreviewProps > (
23+ ( ) => import ( "@uiw/react-markdown-preview" ) ,
24+ {
25+ ssr : false ,
26+ }
27+ )
28+
2029export default function IndexPage ( ) {
2130 let model = "gpt-3.5-turbo"
2231 let [ md , setMd ] = useState ( "# Hello" )
@@ -120,7 +129,14 @@ export default function IndexPage() {
120129 </ div >
121130 </ TabsContent >
122131
123- < TabsContent value = "preview" > Soon</ TabsContent >
132+ < TabsContent value = "preview" >
133+ < div >
134+ < MarkdownPreview
135+ className = "prose dark:prose-invert"
136+ source = { md }
137+ />
138+ </ div >
139+ </ TabsContent >
124140 </ Tabs >
125141 </ div >
126142 < div className = "space-y-2" >
You can’t perform that action at this time.
0 commit comments