import { jsx as _jsx } from "react/jsx-runtime";
import { Link, Wrapper } from "./styled";
export const isActive = (locale) => {
    return document.location.pathname.split("/").some((el) => el === locale);
};
export const getLangFromPath = (path, langList = ["en", "zh"], defaultLang = "en") => {
    const langs = path.split("/").filter((el) => langList.includes(el));
    const lang = langs.length > 0 ? langs[0] : defaultLang;
    return lang;
};
export const LocaleLink = ({ locale, active, theme, children, inverted, className, onClick }) => (_jsx(Link, { href: `/${locale}`, onClick: onClick, active: (active || isActive(locale)), inverted: inverted, theme: theme, className: className, children: children }));
const Locale = (props) => (_jsx(Wrapper, { theme: props.theme, children: props.children }));
export default Locale;
//# sourceMappingURL=index.js.map