@@ -1,5 +1,5 @@
1import { useRouter } from 'next/router'
1import { useRouter } from 'next/router'
2−import { getPostBySlug, getAllPosts, getNextPost, getPreviousPost } from '../../lib/lib'
2+import { getPostBySlug, getAllPosts, getNextPost, getPreviousPost, formatDate } from '../../lib/lib'
3import Head from 'next/head'
3import Head from 'next/head'
4import Link from 'next/link'
4import Link from 'next/link'
5import ErrorPage from '../404'
5import ErrorPage from '../404'
@@ -7,6 +7,7 @@ import Container from '../../components/Container'
7import Markdown from '../../components/Markdown'
7import Markdown from '../../components/Markdown'
8import Header from '../../components/Header'
8import Header from '../../components/Header'
9import Footer from '../../components/Footer'
9import Footer from '../../components/Footer'
10+import BackgroundImage from '../../components/BackgroundImage'
10import SingleColumn from '../../components/SingleColumn'
11import SingleColumn from '../../components/SingleColumn'
@@ -23,15 +24,52 @@ export default function Post({ post, nextPost, previousPost }) {
23 <Container>
24 <Container>
24 <SingleColumn>
25 <SingleColumn>
25 <Header />
26 <Header />
26− <section className="flex flex-col layout-wide pt-48">
27+ <section className="flex flex-col layout-wide pt-24">
27 <h1>{post.title}</h1>
28 <h1>{post.title}</h1>
31+ post.extra.author ? <div className='type-ui text-gray mt-4'>{post.extra.author}</div> : null
34+ post.extra.ship ? <div className='type-ui text-gray font-mono'>{post.extra.ship}</div> : null
37+ <div className='type-ui text-gray mt-16'>{formatDate(new Date(post.date))}</div>
28 </section>
39 </section>
29− <article className="flex items-center pt-48">
40+ <article className="flex justify-center pt-12">
30− <Markdown post={post} />
41+ <Markdown post={post} />
31 </article>
42 </article>
32− <section className="layout-narrow pt-48">
43+ <section className="layout-wide pt-24 flex">
33− <Link href={nextPost.slug}>{nextPost.title}</Link>
44+
34− <Link href={previousPost.slug}>{previousPost.title}</Link>
45+ {
46+ previousPost === null
47+ ? <div className={`w-1/2 mr-4`} />
48+ : <div className={`cursor-pointer w-1/2 mr-4`} key={previousPost.slug}>
49+ <Link href={'/blog/' + previousPost.slug} key={`post-${previousPost.slug}`}>
51+ <h3>Previous Post</h3>
52+ <BackgroundImage className="w-full h-80 rounded-lg" src={previousPost.extra.image || ''} />
53+ <p className='text-black mt-2'>{previousPost.title || ''}</p>
54+ <p className='text-gray'>{formatDate(new Date(previousPost.date))}</p>
61+ ? <div className={`w-1/2 ml-4`} />
62+ : <div className={`cursor-pointer w-1/2 ml-4`}>
63+ <Link href={'/blog/' + nextPost.slug} key={`post-${nextPost.slug}`}>
66+ <BackgroundImage className="w-full h-80 rounded-lg" src={nextPost.extra.image || ''} />
67+ <p className='text-black mt-2'>{nextPost.title || ''}</p>
68+ <p className='text-gray'>{formatDate(new Date(nextPost.date))}</p>
35 </section>
73 </section>
36 </SingleColumn>
74 </SingleColumn>
37 <Footer />
75 <Footer />
@@ -48,7 +86,7 @@ export async function getStaticProps({ params }) {
49 'description',
87 'description',
51− ], 'blog')
89+ ], 'blog') || null
53 const previousPost = getPreviousPost(params.slug, [
91 const previousPost = getPreviousPost(params.slug, [
@@ -56,7 +94,7 @@ export async function getStaticProps({ params }) {
57 'description',
95 'description',
59− ], 'blog')
97+ ], 'blog') || null
61 const post = getPostBySlug(params.slug, [
99 const post = getPostBySlug(params.slug, [