@@ -10,7 +10,6 @@ import {
1010} from "@headlessui/react" ;
1111import { ChevronUpIcon } from "@heroicons/react/20/solid" ;
1212import Editor from "@/components/editor/editor" ;
13- import RenderPost from "@/components/editor/editor/RenderPost" ;
1413import useCreatePage from "@/hooks/useCreatePage" ;
1514import { usePrompt } from "@/components/PromptService" ;
1615
@@ -138,7 +137,7 @@ const Create = () => {
138137 < ChevronUpIcon
139138 className = { `${
140139 open ? "rotate-180 transform" : ""
141- } h-5 w-5 text-neutral-400`}
140+ } h-5 w-5 text-neutral-400`}
142141 />
143142 </ DisclosureButton >
144143 < DisclosurePanel className = "pb-2 pt-4" >
@@ -214,68 +213,66 @@ const Create = () => {
214213 < div className = "z-60 absolute bottom-0 left-0 right-0 top-0 bg-black opacity-25" />
215214 </ div >
216215 ) }
217- < div className = "bg-black" >
218- < div className = "mx-auto w-full max-w-7xl flex-grow text-black lg:flex xl:px-8" >
219- { /* Left sidebar & main wrapper */ }
220- < div className = "min-w-0 flex-1 xl:flex" >
221- < div className = "lg:min-w-0 lg:flex-1" >
222- < div className = "h-full min-h-[40rem] px-4 py-0 sm:px-6 lg:px-4 lg:py-6" >
223- { /* Start main area*/ }
224- < div className = "relative h-full" >
225- < div className = "bg-neutral-900 text-white shadow-xl" >
226- < div className = "bg-neutral-900 px-4 py-6 sm:p-6 lg:pb-8" >
227- { ! body && (
228- < Controller
229- name = "body"
230- control = { control }
231- render = { ( { field } ) => (
232- < Editor { ...field } initialValue = { "{}" } />
233- ) }
234- />
235- ) }
236- { body && body . length > 0 && (
237- < Controller
238- name = "body"
239- control = { control }
240- render = { ( { field } ) => (
241- < Editor { ...field } initialValue = { body } />
242- ) }
243- />
244- ) }
216+ < div className = "mx-auto w-full max-w-7xl flex-grow text-black lg:flex xl:px-8" >
217+ { /* Left sidebar & main wrapper */ }
218+ < div className = "min-w-0 flex-1 xl:flex" >
219+ < div className = "lg:min-w-0 lg:flex-1" >
220+ < div className = "h-full min-h-[40rem] px-4 py-0 sm:px-6 lg:px-4" >
221+ { /* Start main area*/ }
222+ < div className = "relative h-full" >
223+ < div className = "mx-auto break-words px-2 pb-4 sm:px-4 md:max-w-3xl" >
224+ < div className = "prose mx-auto max-w-3xl dark:prose-invert lg:prose-lg" >
225+ { ! body && (
226+ < Controller
227+ name = "body"
228+ control = { control }
229+ render = { ( { field } ) => (
230+ < Editor { ...field } initialValue = { "{}" } />
231+ ) }
232+ />
233+ ) }
234+ { body && body . length > 0 && (
235+ < Controller
236+ name = "body"
237+ control = { control }
238+ render = { ( { field } ) => (
239+ < Editor { ...field } initialValue = { body } />
240+ ) }
241+ />
242+ ) }
245243
246- < div className = "flex items-center justify-between" >
247- < >
248- { saveStatus === "loading" && < p > Auto-saving...</ p > }
249- { saveStatus === "error" && savedTime && (
250- < p className = "text-xs text-red-600 lg:text-sm" >
251- { `Error saving, last saved: ${ savedTime . toString ( ) } ` }
252- </ p >
253- ) }
254- { saveStatus === "success" && savedTime && (
255- < p className = "text-xs text-neutral-400 lg:text-sm" >
256- { `Saved: ${ savedTime . toString ( ) } ` }
257- </ p >
258- ) }
259- </ >
260- < div />
244+ < div className = "flex items-center justify-between" >
245+ < >
246+ { saveStatus === "loading" && < p > Auto-saving...</ p > }
247+ { saveStatus === "error" && savedTime && (
248+ < p className = "text-xs text-red-600 lg:text-sm" >
249+ { `Error saving, last saved: ${ savedTime . toString ( ) } ` }
250+ </ p >
251+ ) }
252+ { saveStatus === "success" && savedTime && (
253+ < p className = "text-xs text-neutral-400 lg:text-sm" >
254+ { `Saved: ${ savedTime . toString ( ) } ` }
255+ </ p >
256+ ) }
257+ </ >
258+ < div />
261259
262- < div className = "flex" >
263- < button
264- type = "button"
265- disabled = { isDisabled }
266- className = "ml-5 inline-flex justify-center bg-gradient-to-r from-orange-400 to-pink-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:from-orange-300 hover:to-pink-500 focus:outline-none focus:ring-2 focus:ring-pink-300 focus:ring-offset-2 disabled:opacity-50"
267- onClick = { ( ) => setOpen ( true ) }
268- >
269- { ! data ?. published && "Publish" }
270- { data ?. published && "Save Changes" }
271- </ button >
272- </ div >
260+ < div className = "flex" >
261+ < button
262+ type = "button"
263+ disabled = { isDisabled }
264+ className = "ml-5 inline-flex justify-center bg-gradient-to-r from-orange-400 to-pink-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:from-orange-300 hover:to-pink-500 focus:outline-none focus:ring-2 focus:ring-pink-300 focus:ring-offset-2 disabled:opacity-50"
265+ onClick = { ( ) => setOpen ( true ) }
266+ >
267+ { ! data ?. published && "Publish" }
268+ { data ?. published && "Save Changes" }
269+ </ button >
273270 </ div >
274271 </ div >
275272 </ div >
276273 </ div >
277- { /* End main area */ }
278274 </ div >
275+ { /* End main area */ }
279276 </ div >
280277 </ div >
281278 </ div >
0 commit comments