use Next.js

This commit is contained in:
polv committed 2020-12-17 23:15:28 +07:00
1 parent cf94c66807
commit 20a00d5ab3
34 files changed
+7117 -1

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
import { THEME } from '~/assets/global'
import { formatDate } from '~/assets/util'
import { IPostTeaser } from '~/server/db'
import Link from 'next/link'
const PostTeaser = ({ post }: { post: IPostTeaser }) => {
return (
<section>
<h2>
<Link href={`/post/${post.path}`}>
<a>{post.title}</a>
</Link>
</h2>
<small>
<span>
by&nbsp;
{THEME.author.url ? (
<a
href={THEME.author.url}
target="_blank"
rel="noopener noreferrer"
>
{THEME.author.name}
</a>
) : (
<span>{THEME.author.name}</span>
)}
</span>
{post.date ? (
<span style={{ float: 'right' }}>{formatDate(post.date)}</span>
) : null}
</small>
<article
style={{ marginTop: '2rem' }}
dangerouslySetInnerHTML={{ __html: post.excerptHtml }}
></article>
</section>
)
}
export default PostTeaser