--- // starlight's Hero (0.36), with the actions rendered as the web app's // buttons. markup and styles otherwise match upstream import { Image } from "astro:assets"; import Button from "$lib/components/ui/Button.svelte"; import ArrowRight from "~icons/lucide/arrow-right"; const { data } = Astro.locals.starlightRoute.entry; const { title = data.title, tagline, image, actions = [] } = data.hero || {}; const imageAttrs = { loading: "eager" as const, decoding: "async" as const, width: 400, height: 400, alt: image?.alt || "", }; let darkImage: ImageMetadata | undefined; let lightImage: ImageMetadata | undefined; let rawHtml: string | undefined; if (image) { if ("file" in image) { darkImage = image.file; } else if ("dark" in image) { darkImage = image.dark; lightImage = image.light; } else { rawHtml = image.html; } } // the primary action is the web app's call to action, arrow on the right. // the others need a text color: the web app sets it on every , starlight doesn't const variants = { primary: "primary", secondary: "default", minimal: "ghost" } as const; ---
{ darkImage && ( ) } {lightImage && } {rawHtml &&
}

{tagline &&
}
{ actions.length > 0 && (
{actions.map(({ link: href, text, variant = "primary" }) => ( ))}
) }