43 lines
1.7 KiB
Plaintext
43 lines
1.7 KiB
Plaintext
---
|
|
import { Image } from 'astro:assets';
|
|
import type { Entry } from '../data/records';
|
|
|
|
interface Props { items: Entry[]; }
|
|
const { items } = Astro.props;
|
|
|
|
const photos = import.meta.glob<{ default: ImageMetadata }>('../assets/images/presentations/**/*.{jpg,jpeg,png,webp}', { eager: true });
|
|
const photo = (file: string) => photos[`../assets/images/presentations/${file}`]?.default;
|
|
---
|
|
|
|
<ul class="flex flex-col gap-3">
|
|
{
|
|
items.map((r) => (
|
|
<li class="border border-line bg-panel px-5 py-4">
|
|
<div class="flex flex-wrap items-center gap-x-3 font-mono text-[12px] text-muted">
|
|
<span>{r.date}</span>
|
|
{r.tag && <span class="border border-accent px-1.5 py-px text-accent">{r.tag}</span>}
|
|
</div>
|
|
<div class="mt-1.5 text-[20px] leading-snug font-semibold">
|
|
{r.href ? <a class="hover:text-amber" href={r.href} target="_blank" rel="noopener">{r.title}</a> : r.title}
|
|
</div>
|
|
{r.detail && <div class="mt-1.5 text-body">{r.detail}</div>}
|
|
{r.images && (
|
|
<ul class="mt-4 grid grid-cols-2 gap-3 md:grid-cols-3">
|
|
{r.images.length === 0 && (
|
|
<li class="flex aspect-[4/3] items-center justify-center border border-dashed border-line-2 font-mono text-[12px] text-muted">PHOTO</li>
|
|
)}
|
|
{r.images.map((img) => {
|
|
const src = photo(img.file);
|
|
return src && (
|
|
<li>
|
|
<Image src={src} alt={img.alt} widths={[400, 800]} sizes="(min-width: 768px) 33vw, 50vw" class="aspect-[4/3] w-full border border-line object-cover" />
|
|
</li>
|
|
);
|
|
})}
|
|
</ul>
|
|
)}
|
|
</li>
|
|
))
|
|
}
|
|
</ul>
|