|
1 | | -import { FC } from "react"; |
2 | 1 | import Image from "next/image"; |
3 | 2 | import { Clock, Pin } from "lucide-react"; |
4 | 3 | import Badge from "@/components/ui/Badge"; |
5 | 4 | import { Card, CardContent, CardFooter } from "@/components/ui/Card"; |
6 | | -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/Tooltip"; |
7 | | -import { EventType } from "@/domains/Events"; |
8 | | -import { useFormatDate } from "@/lib/format"; |
9 | | -import { Link } from "@/lib/navigation"; |
| 5 | +import { UserEventType } from "@/domains/Events"; |
| 6 | +import { useFormatDateEvent } from "@/lib/format"; |
10 | 7 |
|
11 | | -const MyEventCard: FC<{ data: EventType }> = ({ data }) => { |
12 | | - const { id, title, date, image, status, duration, location } = data; |
| 8 | +const MyEventCard = ({ data }: { data: UserEventType }) => { |
| 9 | + const { order_no, status } = data; |
13 | 10 |
|
14 | 11 | return ( |
15 | | - <Link href={`/events/${id}`}> |
| 12 | + <section> |
16 | 13 | <div className="grid gap-4 lg:grid-cols-4"> |
17 | | - <div className="bg-muted overflow-hidden rounded-lg"> |
| 14 | + <div className="relative flex items-center justify-center overflow-hidden rounded-lg border"> |
| 15 | + <div |
| 16 | + className="absolute inset-0 scale-110 bg-cover bg-center blur-xs" |
| 17 | + style={{ |
| 18 | + backgroundImage: `url(${data.event_detail.image ?? "/assets/images/events/fallbackImage.webp"})`, |
| 19 | + }} |
| 20 | + /> |
18 | 21 | <Image |
19 | | - alt={String(id)} |
20 | | - src={image ?? "/assets/images/events/fallbackImage.webp"} |
| 22 | + alt={`Event ${order_no}`} |
| 23 | + src={data.event_detail.image ?? "/assets/images/events/fallbackImage.webp"} |
21 | 24 | width={540} |
22 | 25 | height={240} |
23 | | - className="object-cover object-center" |
| 26 | + className="relative z-10 object-cover object-center" |
24 | 27 | /> |
25 | 28 | </div> |
26 | 29 | <Card className="flex size-full flex-col rounded-lg border shadow-md lg:col-span-3"> |
27 | 30 | <CardContent className="px-4 pt-4 pb-0"> |
28 | | - <Badge className="mb-2" variant={`${status}`}> |
29 | | - {status} |
30 | | - </Badge> |
31 | | - <TooltipProvider> |
32 | | - <Tooltip> |
33 | | - <TooltipTrigger asChild> |
34 | | - <h2 className="text-hmc-blue-600 line-clamp-2 text-base font-bold sm:text-xl">{title}</h2> |
35 | | - </TooltipTrigger> |
36 | | - <TooltipContent>{title}</TooltipContent> |
37 | | - </Tooltip> |
38 | | - </TooltipProvider> |
| 31 | + <div className="mb-2 flex items-center gap-2"> |
| 32 | + <span className="text-xs font-medium text-gray-500">#{order_no}</span> |
| 33 | + <Badge variant={status}>{status}</Badge> |
| 34 | + </div> |
| 35 | + |
| 36 | + <h2 className="text-hmc-blue-600 line-clamp-2 text-base font-bold sm:text-xl">{data.event_detail.title}</h2> |
39 | 37 | </CardContent> |
40 | 38 | <CardFooter className="mt-auto flex flex-col items-start gap-2 px-4 pt-3 pb-4"> |
41 | | - <p className="line-clamp-1">{useFormatDate(date)}</p> |
42 | 39 | <div className="flex items-center gap-2"> |
43 | | - <Clock size={15} /> |
44 | | - <p className="text-sm">{duration}</p> |
| 40 | + <Clock size={15} className="text-gray-500" /> |
| 41 | + <p className="text-sm">{useFormatDateEvent(data.event_detail.date as string) || "-"}</p> |
45 | 42 | </div> |
46 | 43 | <div className="flex items-center gap-2"> |
47 | | - <Pin size={15} /> |
48 | | - <p className="text-sm">{location}</p> |
| 44 | + <Pin size={15} className="text-gray-500" /> |
| 45 | + <p className="line-clamp-1 text-sm">{data.event_detail.location || "-"}</p> |
49 | 46 | </div> |
50 | 47 | </CardFooter> |
51 | 48 | </Card> |
52 | 49 | </div> |
53 | | - </Link> |
| 50 | + </section> |
54 | 51 | ); |
55 | 52 | }; |
| 53 | + |
56 | 54 | export default MyEventCard; |
0 commit comments