on fb4fcaf help sign in
urbit.org/components/PostPreview.js
26 lines 772 B history raw
1import Link from "next/link";
2import BackgroundImage from "./BackgroundImage";
3import { formatDate } from "../lib/lib";
5export default function PostPreview(props) {
6 return (
7 <div className={`cursor-pointer ${props.className}`}>
8 {props.title ? <h3 className="mb-2">{props.title}</h3> : null}
10 <Link href={`/blog/${props.post.slug}`} key={`post-${props.post.slug}`}>
11 <div>
12 <BackgroundImage
13 className="w-full h-80 rounded-lg"
14 src={props.post.extra.image || ""}
15 />
16 <p className="text-black mt-2">{props.post.title}</p>
17 <p className="text-gray">{formatDate(new Date(props.post.date))}</p>
18 </div>
19 </Link>
20 </div>
21 );
24PostPreview.defaultProps = {
25 className: "",
26};