--- import { Image } from 'astro:assets'; const found = import.meta.glob<{ default: ImageMetadata }>('../assets/images/photography/*.{jpg,jpeg,png,webp,avif}', { eager: true }); const photos = Object.entries(found) .sort(([a], [b]) => a.localeCompare(b)) .slice(0, 3) .map(([path, mod]) => ({ src: mod.default, caption: (path.split('/').pop() ?? '').replace(/\.[^.]+$/, '').replace(/[-_]+/g, ' ').toUpperCase(), })); const slots = [0, 1, 2].map((i) => photos[i] ?? null); const corner = "before:absolute before:size-[22px] before:border-accent before:content-[''] after:absolute after:size-[22px] after:border-accent after:content-['']"; const shot = (photo: boolean) => [ 'relative m-0 overflow-hidden border border-line bg-panel', !photo && `${corner} before:top-2.5 before:left-2.5 before:border-t-2 before:border-l-2 after:right-2.5 after:bottom-2.5 after:border-r-2 after:border-b-2`, ]; const caption = 'absolute inset-x-0 bottom-0 px-5 pt-[18px] pb-3 font-mono text-[12px]'; const captionPhoto = 'bg-[linear-gradient(transparent,rgba(5,8,7,0.85))] text-fg'; ---
{slots[0] ? {slots[0].caption} : null}
{slots[0] ? slots[0].caption : '[PHOTO 1 ยท FEATURED]'}
{ [1, 2].map((i) => (
{slots[i] ? {slots[i]!.caption} : null}
{slots[i] ? slots[i]!.caption : `[PHOTO ${i + 1}]`}
)) }