@@ -2,46 +2,83 @@ import { lastEdit } from "@/lib/api"
22import { blog } from "@/lib/source"
33import { getMDXComponents } from "@/mdx-components"
44import { PathUtils } from "fumadocs-core/source"
5- import { InlineTOC } from "fumadocs-ui/components/inline-toc"
65import { notFound } from "next/navigation"
76
87export default async function Page ( props : PageProps < "/blog/[slug]" > ) {
98 const params = await props . params
109 const page = blog . getPage ( [ params . slug ] )
1110 if ( ! page ) notFound ( )
1211 const { body : Mdx , toc } = page . data
13-
1412 return (
1513 < >
16- < div className = "container mx-auto mt-12 space-y-10" >
17- < div className = "mx-auto flex w-full flex-col gap-4 px-8" >
18- < h1 className = "text-5xl font-semibold tracking-tight text-white" > { page ?. data . title } </ h1 >
19- < p className = "text-xl text-neutral-500" > { page ?. data . description } </ p >
20-
21- < div className = "flex flex-row gap-8 mt-4 border border-white/20 p-4" >
22- < div className = "flex flex-col gap-1" >
23- < p className = "text-xs uppercase tracking-wide text-neutral-500" > Author</ p >
24- < p className = "font-medium" > { page . data . author } </ p >
25- </ div >
26-
27- < div className = "flex flex-col gap-1" >
28- < p className = "text-xs uppercase tracking-wide text-neutral-500" > Published</ p >
29- < p className = "font-medium" >
30- { new Date (
31- await lastEdit ( page ) ?? PathUtils . basename ( page . path , PathUtils . extname ( page . path ) ) ,
32- ) . toLocaleDateString ( "en-US" , { month : "short" , day : "numeric" , year : "numeric" } ) }
33- </ p >
14+ < header className = "border-b border-white/10" >
15+ < div className = "container mx-auto px-4 py-12 md:py-16" >
16+ < div className = "mx-auto max-w-7xl" >
17+ < div className = "grid gap-10 lg:grid-cols-[minmax(0,1fr)_280px]" >
18+ < div className = "max-w-3xl" >
19+ < nav className = "mb-6 text-sm text-neutral-500" >
20+ < a className = "hover:text-white" href = "/blog" > Blog</ a >
21+ < span className = "mx-2" > /</ span >
22+ < span className = "text-neutral-400" > { page ?. data . title } </ span >
23+ </ nav >
24+ < h1 className = "text-4xl font-bold tracking-tight text-white md:text-5xl" >
25+ { page ?. data . title }
26+ </ h1 >
27+ { page ?. data . description && (
28+ < p className = "mt-4 text-lg leading-relaxed text-neutral-400" >
29+ { page ?. data . description }
30+ </ p >
31+ ) }
32+ < div className = "mt-6 flex flex-wrap items-center gap-4 text-sm text-neutral-400" >
33+ { page . data . author && (
34+ < div className = "flex items-center gap-2" >
35+ < span className = "text-neutral-500" > By</ span >
36+ < span className = "font-medium text-white" > { page . data . author } </ span >
37+ </ div >
38+ ) }
39+ < div className = "h-4 w-px bg-white/10" />
40+ < time >
41+ { new Date (
42+ await lastEdit ( page ) ?? PathUtils . basename ( page . path , PathUtils . extname ( page . path ) ) ,
43+ ) . toLocaleDateString ( "en-US" , { month : "long" , day : "numeric" , year : "numeric" } ) }
44+ </ time >
45+ </ div >
46+ </ div >
3447 </ div >
3548 </ div >
3649 </ div >
37- </ div >
38- < article className = "flex flex-col mx-auto w-full container gap-16 px-8 py-8 lg:flex-row" >
39- < div className = "prose min-w-0 flex-1 p-4" >
40- < InlineTOC items = { toc } className = "rounded-none mb-8" />
50+ </ header >
4151
42- < Mdx components = { getMDXComponents ( ) } />
52+ < main className = "container mx-auto px-4 py-10" >
53+ < div className = "mx-auto max-w-7xl" >
54+ < div className = "grid gap-10 lg:grid-cols-[minmax(0,1fr)_280px]" >
55+ < article className = "prose prose-invert max-w-3xl" >
56+ < Mdx components = { getMDXComponents ( ) } />
57+ </ article >
58+ { toc . length > 0 && (
59+ < aside className = "hidden lg:block" >
60+ < div className = "sticky top-24 rounded-lg border border-white/10 p-4" >
61+ < h3 className = "mb-3 text-xs font-semibold uppercase tracking-wider text-neutral-400" >
62+ On This Page
63+ </ h3 >
64+ < nav className = "space-y-1" >
65+ { toc . map ( ( item ) => (
66+ < a
67+ key = { item . url }
68+ href = { item . url }
69+ className = "block rounded-md py-1.5 text-sm text-neutral-400 hover:text-white"
70+ style = { { paddingLeft : `${ ( item . depth - 1 ) * 12 } px` } }
71+ >
72+ { item . title }
73+ </ a >
74+ ) ) }
75+ </ nav >
76+ </ div >
77+ </ aside >
78+ ) }
79+ </ div >
4380 </ div >
44- </ article >
81+ </ main >
4582 </ >
4683 )
4784}
0 commit comments