--- import Icon from '@ui/Icon.astro' import icons from '@data/icons.json' import CardTitle from '@ui/CardTitle.astro' interface Props { title?: string type?: 'outline' | 'filled' } const { title, type = 'outline' } = Astro.props // The dev server renders only the first 20 icons so the page stays fast; // `astro build` (the zip package and production site) renders all of them. const limit = import.meta.env.DEV ? 20 : Infinity const entries = Object.entries(icons as Record }>) .filter(([, icon]) => icon.svg?.[type]) .slice(0, limit) ---
{title}
{ entries.map( ([iconName, icon]) => icon.svg?.[type] && ( ), ) } {/* 21 empty divs (flexbox filler) */} {Array.from({ length: 21 }).map(() =>
)}