diff --git a/components/blog-card.tsx b/components/blog-card.tsx new file mode 100644 index 0000000..502517f --- /dev/null +++ b/components/blog-card.tsx @@ -0,0 +1,51 @@ +import Link from "next/link"; +import React from "react"; +import { BlurImage } from "./blur-image"; +import { Logo } from "./Logo"; +import Image from "next/image"; +import Balancer from "react-wrap-balancer"; +import { BlogWithSlug } from "@/lib/blog"; + +export const BlogCard = ({ blog }: { blog: BlogWithSlug }) => { + const truncate = (text: string, length: number) => { + return text.length > length ? text.slice(0, length) + "..." : text; + }; + return ( + + {blog.image ? ( + + ) : ( +
+ +
+ )} +
+
+ {blog.author.name} +

{blog.author.name}

+
+

+ {blog.title} +

+

+ {truncate(blog.description, 100)} +

+
+ + ); +};