mirror of
https://github.com/privacy-scaling-explorations/pse.dev.git
synced 2026-01-10 22:58:06 -05:00
config to show/hide language switcher
This commit is contained in:
@@ -21,11 +21,12 @@ import { useTranslation } from "@/app/i18n/client"
|
||||
import { LanguageMapping, languagesItems } from "@/app/i18n/settings"
|
||||
|
||||
import { Icons } from "./icons"
|
||||
import { Dropdown } from "./ui/dropdown"
|
||||
|
||||
const LanguageSwitcher = ({ lang }: LangProps["params"]) => {
|
||||
const [isOpen, setIsOpen] = useState(false)
|
||||
|
||||
if (!siteConfig?.showLanguageSwitcher) return null
|
||||
|
||||
return (
|
||||
<div className="flex flex-col border-b-2 border-white px-[14px] py-[16px] pt-0">
|
||||
<button
|
||||
|
||||
@@ -6,6 +6,7 @@ import * as DropdownMenu from "@radix-ui/react-dropdown-menu"
|
||||
import i18next from "i18next"
|
||||
import { Trans } from "react-i18next/TransWithoutContext"
|
||||
|
||||
import { siteConfig } from "@/config/site"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { MainNav, MainNavProps } from "@/components/main-nav"
|
||||
import { useTranslation } from "@/app/i18n/client"
|
||||
@@ -49,23 +50,25 @@ export function SiteHeader({ lang }: SiteHeaderProps) {
|
||||
<div className="flex h-16 items-center justify-between space-x-4 sm:space-x-0">
|
||||
<MainNav items={MAIN_NAV} lang={lang} />
|
||||
<SiteHeaderMobile lang={lang} />
|
||||
<div className="hidden outline-none md:block">
|
||||
<Dropdown
|
||||
label={
|
||||
<div className="flex items-center gap-1">
|
||||
<Icons.globe size={22} />
|
||||
<span className="!text-base !font-normal text-tuatara-950">
|
||||
{LanguageMapping[lang] ?? LanguageMapping["en"]}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
defaultItem={lang}
|
||||
items={languagesItems}
|
||||
onChange={(lang) => {
|
||||
window?.location?.replace(`/${lang}`)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{siteConfig?.showLanguageSwitcher && (
|
||||
<div className="hidden outline-none md:block">
|
||||
<Dropdown
|
||||
label={
|
||||
<div className="flex items-center gap-1">
|
||||
<Icons.globe size={22} />
|
||||
<span className="!text-base !font-normal text-tuatara-950">
|
||||
{LanguageMapping[lang] ?? LanguageMapping["en"]}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
defaultItem={lang}
|
||||
items={languagesItems}
|
||||
onChange={(lang) => {
|
||||
window?.location?.replace(`/${lang}`)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</header>
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export type SiteConfig = typeof siteConfig
|
||||
1
|
||||
|
||||
export const siteConfig = {
|
||||
showLanguageSwitcher: false, // TODO: enable when we have more languages
|
||||
name: "Privacy & Scaling Explorations",
|
||||
description:
|
||||
"Enhancing Ethereum through cryptographic research and collective experimentation.",
|
||||
|
||||
Reference in New Issue
Block a user