30 lines
928 B
TypeScript
30 lines
928 B
TypeScript
import Link from "next/link";
|
|
import { motion } from "motion/react";
|
|
import type { PostMeta } from "@/lib/posts";
|
|
|
|
interface PostCardProps extends PostMeta {
|
|
index?: number;
|
|
}
|
|
|
|
export function PostCard({ slug, title, date, excerpt, index = 0 }: PostCardProps) {
|
|
return (
|
|
<motion.article
|
|
initial={{ opacity: 0, y: 20 }}
|
|
whileInView={{ opacity: 1, y: 0 }}
|
|
transition={{ duration: 0.5, delay: index * 0.07 }}
|
|
viewport={{ once: true }}
|
|
className="scroll-mt-20"
|
|
>
|
|
<Link href={`/posts/${slug}/`} className="block">
|
|
<time className="font-mono text-sm text-ink-soft">{date}</time>
|
|
<h3 className="font-sans text-2xl font-semibold tracking-tight text-ink mt-1 mb-2 hover:text-accent transition-colors">
|
|
{title}
|
|
</h3>
|
|
{excerpt && (
|
|
<p className="text-ink-soft leading-7">{excerpt}</p>
|
|
)}
|
|
</Link>
|
|
</motion.article>
|
|
);
|
|
}
|