-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathStartupCard.tsx
81 lines (72 loc) · 2.24 KB
/
StartupCard.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { cn, formatDate } from "@/lib/utils";
import { EyeIcon } from "lucide-react";
import Link from "next/link";
import Image from "next/image";
import { Button } from "@/components/ui/button";
import { Author, Startup } from "@/sanity/types";
import { Skeleton } from "@/components/ui/skeleton";
export type StartupTypeCard = Omit<Startup, "author"> & { author?: Author };
const StartupCard = ({ post }: { post: StartupTypeCard }) => {
const {
_createdAt,
views,
author,
title,
category,
_id,
image,
description,
} = post;
return (
<li className="startup-card group">
<div className="flex-between">
<p className="startup_card_date">{formatDate(_createdAt)}</p>
<div className="flex gap-1.5">
<EyeIcon className="size-6 text-primary" />
<span className="text-16-medium">{views}</span>
</div>
</div>
<div className="flex-between mt-5 gap-5">
<div className="flex-1">
<Link href={`/user/${author?._id}`}>
<p className="text-16-medium line-clamp-1">{author?.name}</p>
</Link>
<Link href={`/startup/${_id}`}>
<h3 className="text-26-semibold line-clamp-1">{title}</h3>
</Link>
</div>
<Link href={`/user/${author?._id}`}>
<Image
src={author?.image!}
alt={author?.name!}
width={48}
height={48}
className="rounded-full"
/>
</Link>
</div>
<Link href={`/startup/${_id}`}>
<p className="startup-card_desc">{description}</p>
<img src={image} alt="placeholder" className="startup-card_img" />
</Link>
<div className="flex-between gap-3 mt-5">
<Link href={`/?query=${category?.toLowerCase()}`}>
<p className="text-16-medium">{category}</p>
</Link>
<Button className="startup-card_btn" asChild>
<Link href={`/startup/${_id}`}>Details</Link>
</Button>
</div>
</li>
);
};
export const StartupCardSkeleton = () => (
<>
{[0, 1, 2, 3, 4].map((index: number) => (
<li key={cn("skeleton", index)}>
<Skeleton className="startup-card_skeleton" />
</li>
))}
</>
);
export default StartupCard;