diff options
| author | nolawz <amananudhiu@gmail.com> | 2026-03-03 04:04:23 +0530 |
|---|---|---|
| committer | nolawz <amananudhiu@gmail.com> | 2026-03-03 04:04:23 +0530 |
| commit | 45026eee4c93bbbe6141dd23a664abe6e9ff3ca2 (patch) | |
| tree | 3d5762cb539d88cf1fc464ab07f9ecd49182ad08 /src/components/EventCard.astro | |
| parent | d41eff9eccf66644c4c60f53cb516bf079937a28 (diff) | |
Added events section and components required for that
Diffstat (limited to 'src/components/EventCard.astro')
| -rw-r--r-- | src/components/EventCard.astro | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/components/EventCard.astro b/src/components/EventCard.astro new file mode 100644 index 0000000..b615c2d --- /dev/null +++ b/src/components/EventCard.astro @@ -0,0 +1,63 @@ +--- +import { Badge } from '@/components/ui/badge' +import { formatDate, iconMappings } from '@/lib/utils' +import { Icon } from 'astro-icon/components' +import { Image } from 'astro:assets' +import type { CollectionEntry } from 'astro:content' +import Link from './Link.astro' + +interface Props { + entry: CollectionEntry<'events'> +} + +const { entry } = Astro.props +const formattedDate = formatDate(entry.data.date) +--- + +<div + class="hover:bg-muted/50 rounded-xl border p-4 transition-colors duration-300 ease-in-out" +> + <Link + href={`/${entry.collection}/${entry.id}`} + class="flex flex-col gap-4 sm:flex-row" + > + { + entry.data.image && ( + <div class="w-full sm:max-w-3xs sm:shrink-0"> + <Image + src={entry.data.image} + alt={entry.data.title} + width={1200} + height={630} + class="object-cover" + /> + </div> + ) + } + + <div class="grow"> + <h3 class="mb-1 text-lg font-medium">{entry.data.title}</h3> + <p class="text-muted-foreground mb-2 text-sm">{entry.data.description}</p> + + <div + class="text-muted-foreground mb-2 flex flex-wrap items-center gap-x-2 text-xs" + > + <span>{formattedDate}</span> + </div> + + { + entry.data.type && ( + <div class="flex flex-wrap gap-2"> + <Badge variant="muted" className="flex items-center gap-x-1"> + <Icon + name={iconMappings[entry.data.type] || 'lucide:hash'} + class="size-3" + /> + {entry.data.type} + </Badge> + </div> + ) + } + </div> + </Link> +</div> |
