Something went wrong. Try again.
My Personal Site (also at https://sammyshear.com) sshear.dev
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748import type { CollectionEntry } from "astro:content";
type Props = { posts: CollectionEntry<"blog">[];};
const categoryColors: Record<string, string> = { Programming: "bg-ctp-mauve text-ctp-base", Linguistics: "bg-ctp-green text-ctp-base", Judaism: "bg-ctp-blue text-ctp-base", General: "bg-ctp-surface2 text-ctp-text"};
export default function Posts({ posts }: Props) { return ( <div className="flex flex-col gap-6"> {posts.map((post: CollectionEntry<"blog">) => { return ( <a className="group flex flex-col bg-ctp-surface0 hover:bg-ctp-surface1 p-6 rounded-lg transition-colors border border-ctp-surface1 hover:border-ctp-sky" key={post.id} href={`/blog/${post.id}`} > <div className="flex items-center gap-3 mb-2"> {post.data.categories.map((tag) => { return ( <span className={`text-xs font-sans font-semibold px-2 py-1 rounded ${categoryColors[tag] || categoryColors.General}`} key={tag} > {tag} </span> ); })} <span className="text-sm text-ctp-subtext0 font-sans"> {post.data.publishedTime.toLocaleDateString()} </span> </div> <span className="text-xl font-sans font-semibold text-ctp-text group-hover:text-ctp-sky transition-colors"> {post.data.title} </span> </a> ); })} </div> );}