import { cell, DEFAULT_H, DEFAULT_W, GRID_GAP, type Item, type Picture } from "./image-layout"; function ImageView( { src, w, h, alt, width, fit: objectFit = "cover" }: { src: string; w: number; h: number; alt: string; width: number; fit?: "cover" | "contain"; }, ) { let scale = Math.min(1, width / w); let fit = Math.round(w * scale); let height = Math.round(h * scale); if (!src) { return (
{alt} ({w}×{h})
); } return ( {alt} ); } function ImageGrid( { count, height, items, scale, width }: { count: number; height: number; items: Item[]; scale: number; width: number; }, ) { let size = cell(width, scale); return (
{items.map((item) => ( ))}
); } function GridImage( { image, height, index, span }: { image: Picture; height: number; index: number; span?: boolean; }, ) { let w = image.width || DEFAULT_W; let h = image.height || DEFAULT_H; let alt = image.alt || ""; if (!image.src) { return (
{alt} ({w}×{h})
); } return ( {alt} ); } export { ImageGrid, ImageView };