|
| 1 | +// import Link from "next/link"; |
| 2 | +// import Image from "next/image"; |
| 3 | + |
| 4 | +// import { |
| 5 | +// Card, |
| 6 | +// CardContent, |
| 7 | +// CardDescription, |
| 8 | +// CardFooter, |
| 9 | +// CardHeader, |
| 10 | +// CardTitle, |
| 11 | +// } from "@/components/ui/card"; |
| 12 | + |
| 13 | +// import type { Event } from "../../hooks/events"; |
| 14 | +// import { Button } from "./button"; |
| 15 | +// import TagList from "./tag-list"; |
| 16 | + |
| 17 | +// interface EventCardProps { |
| 18 | +// event: Event; |
| 19 | +// } |
| 20 | + |
| 21 | +// export default function EventCard({ event }: EventCardProps) { |
| 22 | +// return ( |
| 23 | +// <Card> |
| 24 | +// <CardHeader className="p-3"> |
| 25 | +// <CardTitle>{event.event_name}</CardTitle> |
| 26 | +// <CardDescription>{event.event_location}</CardDescription> |
| 27 | +// </CardHeader> |
| 28 | + |
| 29 | +// <CardContent> |
| 30 | +// <TagList tags={event.tags}></TagList> |
| 31 | +// <p className="line-clamp-3 text-muted-foreground"> |
| 32 | +// {event.event_description} |
| 33 | +// </p> |
| 34 | +// </CardContent> |
| 35 | + |
| 36 | +// <CardFooter className="flex-end flex-row justify-center gap-2"> |
| 37 | +// <Link href={`/events/${event.id}`} className="w-full"> |
| 38 | +// <Button className="w-full rounded-full">View Details</Button> |
| 39 | +// </Link> |
| 40 | +// <Link href={`/events/${event.id}`}> |
| 41 | +// <Button className="rounded-full">Signup</Button> |
| 42 | +// </Link> |
| 43 | +// </CardFooter> |
| 44 | +// </Card> |
| 45 | +// ); |
| 46 | +// } |
| 47 | + |
| 48 | +import Image from "next/image"; |
1 | 49 | import Link from "next/link"; |
2 | 50 |
|
3 | | -import { |
4 | | - Card, |
5 | | - CardContent, |
6 | | - CardDescription, |
7 | | - CardFooter, |
8 | | - CardHeader, |
9 | | - CardTitle, |
10 | | -} from "@/components/ui/card"; |
| 51 | +import { Card } from "@/components/ui/card"; |
11 | 52 |
|
12 | 53 | import type { Event } from "../../hooks/events"; |
13 | | -import { Button } from "./button"; |
14 | | -import TagList from "./tag-list"; |
15 | 54 |
|
16 | 55 | interface EventCardProps { |
17 | 56 | event: Event; |
18 | 57 | } |
19 | 58 |
|
20 | 59 | export default function EventCard({ event }: EventCardProps) { |
| 60 | + const image = event.images?.[0]?.image; |
| 61 | + |
21 | 62 | return ( |
22 | | - <Card> |
23 | | - <CardHeader className="p-3"> |
24 | | - <CardTitle>{event.event_name}</CardTitle> |
25 | | - <CardDescription>{event.event_location}</CardDescription> |
26 | | - </CardHeader> |
27 | | - |
28 | | - <CardContent> |
29 | | - <TagList tags={event.tags}></TagList> |
30 | | - <p className="line-clamp-3 text-muted-foreground"> |
31 | | - {event.event_description} |
32 | | - </p> |
33 | | - </CardContent> |
34 | | - |
35 | | - <CardFooter className="flex-end flex-row justify-center gap-2"> |
36 | | - <Link href={`/events/${event.id}`} className="w-full"> |
37 | | - <Button className="w-full rounded-full">View Details</Button> |
38 | | - </Link> |
39 | | - <Link href={`/events/${event.id}`}> |
40 | | - <Button className="rounded-full">Signup</Button> |
41 | | - </Link> |
42 | | - </CardFooter> |
43 | | - </Card> |
| 63 | + <div className="flex justify-center"> |
| 64 | + <Link href={`/events/${event.id}`} className="group w-full max-w-5xl"> |
| 65 | + <Card className="flex h-[260px] w-full gap-6 rounded-2xl bg-muted/40 p-6 transition-all duration-200 hover:-translate-y-1 hover:shadow-xl active:scale-[0.99]"> |
| 66 | + <div className="flex flex-1 flex-col justify-between overflow-hidden"> |
| 67 | + <div className="space-y-2"> |
| 68 | + <p className="text-sm text-muted-foreground"> |
| 69 | + {new Date(event.event_date).toLocaleDateString("en-AU", { |
| 70 | + day: "2-digit", |
| 71 | + month: "2-digit", |
| 72 | + year: "numeric", |
| 73 | + })} |
| 74 | + </p> |
| 75 | + |
| 76 | + <h2 className="text-2xl font-semibold leading-tight"> |
| 77 | + {event.event_name} |
| 78 | + </h2> |
| 79 | + |
| 80 | + <p className="text-muted-foreground">{event.event_location}</p> |
| 81 | + |
| 82 | + <div className="no-scrollbar flex gap-2 overflow-x-auto py-2"> |
| 83 | + {event.tags.map((tag) => ( |
| 84 | + <span |
| 85 | + key={tag.id} |
| 86 | + className="whitespace-nowrap rounded-full bg-primary/10 px-3 py-1 text-sm text-primary" |
| 87 | + > |
| 88 | + {tag.name} |
| 89 | + </span> |
| 90 | + ))} |
| 91 | + </div> |
| 92 | + |
| 93 | + <p className="line-clamp-3 text-sm text-muted-foreground"> |
| 94 | + {event.event_description} |
| 95 | + </p> |
| 96 | + </div> |
| 97 | + </div> |
| 98 | + |
| 99 | + <div className="relative h-full w-[280px] flex-shrink-0 overflow-hidden rounded-xl bg-gray-200"> |
| 100 | + {image && ( |
| 101 | + <Image |
| 102 | + src={image} |
| 103 | + alt={event.event_name} |
| 104 | + fill |
| 105 | + className="object-cover transition-transform duration-300 group-hover:scale-105" |
| 106 | + /> |
| 107 | + )} |
| 108 | + </div> |
| 109 | + </Card> |
| 110 | + </Link> |
| 111 | + </div> |
44 | 112 | ); |
45 | 113 | } |
0 commit comments