alinea
Version:
Headless git-based CMS
111 lines (107 loc) • 4.35 kB
JavaScript
import {
Mo
} from "../../../chunks/chunk-I26ZIF6Q.js";
import "../../../chunks/chunk-2STBQ2Y4.js";
import "../../../chunks/chunk-WLKPH7JA.js";
import "../../../chunks/chunk-HSIHEWFC.js";
import "../../../chunks/chunk-ORDS5C6Z.js";
import "../../../chunks/chunk-AICQFCVN.js";
import "../../../chunks/chunk-SOTBYUJY.js";
import "../../../chunks/chunk-2NTSADJL.js";
import "../../../chunks/chunk-VUACWPFC.js";
import {
dist_default
} from "../../../chunks/chunk-A5O3N2GS.js";
import "../../../chunks/chunk-NZLE2WMY.js";
// src/dashboard/view/entry/LangSwitch.tsx
import { HStack, Icon } from "alinea/ui";
import { IcRoundLanguage } from "alinea/ui/icons/IcRoundLanguage";
import { IcRoundUnfoldMore } from "alinea/ui/icons/IcRoundUnfoldMore";
// src/dashboard/view/entry/LangSwitch.module.scss
var LangSwitch_module_default = {
"langswitch": "alinea-LangSwitch-langswitch",
"is-inline": "alinea-LangSwitch-is-inline",
"isInline": "alinea-LangSwitch-is-inline",
"langswitch-input": "alinea-LangSwitch-langswitch-input",
"langswitchInput": "alinea-LangSwitch-langswitch-input",
"langswitch-input-label": "alinea-LangSwitch-langswitch-input-label",
"langswitchInputLabel": "alinea-LangSwitch-langswitch-input-label",
"is-placeholder": "alinea-LangSwitch-is-placeholder",
"isPlaceholder": "alinea-LangSwitch-is-placeholder",
"langswitch-input-icon": "alinea-LangSwitch-langswitch-input-icon",
"langswitchInputIcon": "alinea-LangSwitch-langswitch-input-icon",
"is-lang": "alinea-LangSwitch-is-lang",
"isLang": "alinea-LangSwitch-is-lang",
"langswitch-dropdown": "alinea-LangSwitch-langswitch-dropdown",
"langswitchDropdown": "alinea-LangSwitch-langswitch-dropdown",
"langswitch-dropdown-inner": "alinea-LangSwitch-langswitch-dropdown-inner",
"langswitchDropdownInner": "alinea-LangSwitch-langswitch-dropdown-inner",
"langswitch-dropdown-option": "alinea-LangSwitch-langswitch-dropdown-option",
"langswitchDropdownOption": "alinea-LangSwitch-langswitch-dropdown-option",
"is-active": "alinea-LangSwitch-is-active",
"isActive": "alinea-LangSwitch-is-active",
"is-selected": "alinea-LangSwitch-is-selected",
"isSelected": "alinea-LangSwitch-is-selected",
"langswitch-dropdown-option-icon": "alinea-LangSwitch-langswitch-dropdown-option-icon",
"langswitchDropdownOptionIcon": "alinea-LangSwitch-langswitch-dropdown-option-icon"
};
// src/dashboard/view/entry/LangSwitch.tsx
import { jsx, jsxs } from "react/jsx-runtime";
var styles = dist_default(LangSwitch_module_default);
function Langswitch({
selected,
locales,
onChange,
inline
}) {
return /* @__PURE__ */ jsx("div", { className: styles.langswitch({ inline }), children: /* @__PURE__ */ jsx(
Mo,
{
value: selected,
onChange: (value) => {
if (!value) return;
onChange(value);
},
children: /* @__PURE__ */ jsxs("div", { children: [
/* @__PURE__ */ jsxs(
Mo.Button,
{
className: styles.langswitch.input({ active: locales.length > 0 }),
children: [
/* @__PURE__ */ jsx(
Icon,
{
icon: IcRoundLanguage,
className: styles.langswitch.input.icon({ lang: true })
}
),
/* @__PURE__ */ jsx("span", { className: styles.langswitch.input.label(), children: selected }),
locales.length > 0 && /* @__PURE__ */ jsx(
Icon,
{
icon: IcRoundUnfoldMore,
className: styles.langswitch.input.icon()
}
)
]
}
),
locales.length > 0 && /* @__PURE__ */ jsx(Mo.Options, { className: styles.langswitch.dropdown(), children: /* @__PURE__ */ jsx("div", { className: styles.langswitch.dropdown.inner(), children: locales.map((locale) => /* @__PURE__ */ jsx(Mo.Option, { value: locale, children: ({ active, selected: selected2 }) => /* @__PURE__ */ jsx(
HStack,
{
center: true,
gap: 4,
className: styles.langswitch.dropdown.option({
active,
selected: selected2
}),
children: locale.toUpperCase()
}
) }, locale)) }) })
] })
}
) });
}
export {
Langswitch
};