feat: display tags in post header
This commit is contained in:
@@ -8,10 +8,23 @@ export const PostMeta: React.FC<{
|
||||
page: Note
|
||||
}> = ({ page }) => {
|
||||
return (
|
||||
<div className="text-zinc-400 mt-2">
|
||||
<div className="text-zinc-400 mt-2 xlog-post-meta">
|
||||
<span className="xlog-post-date align-middle">
|
||||
{formatDate(page.date_published)}
|
||||
</span>
|
||||
<span className="xlog-post-tags ml-4 space-x-1 align-middle">
|
||||
{page.tags
|
||||
?.filter((tag) => tag !== "post" && tag !== "page")
|
||||
.map((tag) => (
|
||||
<UniLink
|
||||
className="hover:text-zinc-600"
|
||||
key={tag}
|
||||
href={`/tag/${tag}`}
|
||||
>
|
||||
<>#{tag}</>
|
||||
</UniLink>
|
||||
))}
|
||||
</span>
|
||||
<span className="align-middle mx-1"> · </span>
|
||||
<UniLink
|
||||
className="xlog-post-blockchain align-middle inline-block"
|
||||
|
||||
@@ -43,11 +43,9 @@ export const SiteArchives: React.FC<{
|
||||
{posts.map((post) => {
|
||||
return (
|
||||
<Link key={post.id} href={`/${post.slug || post.id}`}>
|
||||
<a className="flex justify-between items-center p-1 px-2 rounded-lg -mx-2 hover:bg-zinc-100">
|
||||
<span className="text-accent font-medium">
|
||||
{post.title}
|
||||
</span>
|
||||
<span className="text-zinc-400 mr-3 font-medium whitespace-nowrap">
|
||||
<a className="flex justify-between items-center p-2 rounded-lg -mx-2 hover:bg-zinc-100">
|
||||
<span className="text-zinc-700">{post.title}</span>
|
||||
<span className="text-zinc-400 mr-3 whitespace-nowrap">
|
||||
{formatDate(post.date_published, "MMM D")}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -2,17 +2,20 @@ import Link from "next/link"
|
||||
import { formatDate } from "~/lib/date"
|
||||
import { Paginated, type PostOnSiteHome, Notes } from "~/lib/types"
|
||||
import { EmptyState } from "../ui/EmptyState"
|
||||
import { useRouter } from "next/router"
|
||||
|
||||
export const SiteHome: React.FC<{
|
||||
posts?: Notes
|
||||
}> = ({ posts }) => {
|
||||
const router = useRouter()
|
||||
|
||||
if (!posts) return null
|
||||
|
||||
return (
|
||||
<div className="">
|
||||
{posts.total === 0 && <EmptyState />}
|
||||
{posts.total > 0 && (
|
||||
<div className="xlog-posts space-y-3">
|
||||
<div className="xlog-posts space-y-8">
|
||||
{posts.list.map((post) => {
|
||||
const excerpt = post.summary?.content
|
||||
return (
|
||||
@@ -22,8 +25,26 @@ export const SiteHome: React.FC<{
|
||||
<h3 className="xlog-post-title text-2xl font-bold">
|
||||
{post.title}
|
||||
</h3>
|
||||
<div className="xlog-post-date text-sm text-zinc-400 mt-1">
|
||||
{formatDate(post.date_published)}
|
||||
<div className="xlog-post-meta text-sm text-zinc-400 mt-1">
|
||||
<span className="xlog-post-date">
|
||||
{formatDate(post.date_published)}
|
||||
</span>
|
||||
<span className="xlog-post-tags ml-4 space-x-1">
|
||||
{post.tags
|
||||
?.filter((tag) => tag !== "post" && tag !== "page")
|
||||
.map((tag) => (
|
||||
<span
|
||||
className="hover:text-zinc-600"
|
||||
key={tag}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
router.push(`/tag/${tag}`)
|
||||
}}
|
||||
>
|
||||
#{tag}
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
className="xlog-post-excerpt mt-3 text-zinc-500"
|
||||
|
||||
Reference in New Issue
Block a user