--- import type { HTMLAttributes } from "astro/types"; import Dropdown from "./Dropdown.astro"; import { Icon } from "astro-icon/components"; interface Language { code: string; label: string; flag?: string; dir?: "ltr" | "rtl"; } interface Props extends HTMLAttributes<"div"> { languages: Language[]; storageKey?: string; rootSelector?: string; compact?: boolean; showLabel?: boolean; rootExtraClass?: string; class?: string; onChange?: string; } const { languages = [{ code: "en", label: "English" }], storageKey = "wr-lang", rootSelector = "html", compact = false, showLabel = false, rootExtraClass = "", class: className, onChange = "onLanguageChange", ...rest }: Props = Astro.props; const containerId = `ls-${Math.random().toString(36).slice(2)}`; const icon = "wr:size-4"; const item = "wr:flex wr:w-full wr:items-center wr:gap-x-3.5 wr:rounded-lg wr:px-3 wr:py-2 wr:text-sm wr:hover:bg-gray-100 wr:dark:hover:bg-neutral-900 wr:focus:bg-gray-100 focus:outline-hidden dark:hover:bg-neutral-700 dark:hover:text-neutral-300 dark:focus:bg-neutral-700" const checkBase = "wr:size-4 wr:opacity-0 wr:scale-90 wr:transition"; ---
{showLabel && Language} {languages.map(lang => ( ))}