--- import { Icon } from '@astrojs/starlight/components'; import FluidGrid from './fluid-grid.astro'; import MediaCard from './media-card.astro'; import ThemeImage from './theme-image.astro'; interface Props { labels: { /** Accessible label for the theme toggle. */ legend: string; /** Accessible label for the dark color scheme variant. */ dark: string; /** Accessible label for the light color scheme variant. */ light: string; }; themes: Array<{ /** The name of this theme. */ title: string; /** A short description of this theme. */ description: string; /** URL for this theme’s website. Ideally should link to a demo site showing off the theme. */ href: string; previews: { /** Image filename as found in `src/assets/themes/`, e.g. `ion-light.png`. */ light: string; /** Image filename as found in `src/assets/themes/`, e.g. `ion-dark.png`. */ dark: string; }; }>; } const { labels, themes } = Astro.props; ---
{ /* `` is a pain to position, so we visually hide it and use an `aria-hidden` duplicate for the visual representation. See https://adrianroselli.com/2022/07/use-legend-and-fieldset.html */ } {labels.legend} { (['dark', 'light'] as const).map((variant) => ( )) } {/* If the currently active theme is light mode, default to showing the light mode previews. */}
{ themes.map( async ({ title, description, href, previews }) => previews && (

{title}

) ) }