This commit is contained in:
2026-02-03 17:27:58 +08:00
parent 0af99b6b70
commit 56552863bf
4 changed files with 18 additions and 26 deletions

View File

@@ -0,0 +1,76 @@
"use client";
import { GhostButton } from "../ui/buttons";
import { useState } from "react";
import { Languages } from "lucide-react";
export function LanguageSettings() {
const [showLanguageMenu, setShowLanguageMenu] = useState(false);
const handleLanguageClick = () => {
setShowLanguageMenu((prev) => !prev);
};
const setLocale = async (locale: string) => {
document.cookie = `locale=${locale}`;
window.location.reload();
};
return (
<>
<Languages onClick={handleLanguageClick} size={28} className="navbar-btn" />
<div className="relative">
{showLanguageMenu && (
<div>
<div className="absolute top-10 right-0 rounded-md shadow-md flex flex-col gap-2">
<GhostButton
className="w-full bg-[#35786f]"
onClick={() => setLocale("en-US")}
>
English
</GhostButton>
<GhostButton
className="w-full bg-[#35786f]"
onClick={() => setLocale("zh-CN")}
>
</GhostButton>
<GhostButton
className="w-full bg-[#35786f]"
onClick={() => setLocale("ja-JP")}
>
</GhostButton>
<GhostButton
className="w-full bg-[#35786f]"
onClick={() => setLocale("ko-KR")}
>
</GhostButton>
<GhostButton
className="w-full bg-[#35786f]"
onClick={() => setLocale("de-DE")}
>
Deutsch
</GhostButton>
<GhostButton
className="w-full bg-[#35786f]"
onClick={() => setLocale("fr-FR")}
>
Français
</GhostButton>
<GhostButton
className="w-full bg-[#35786f]"
onClick={() => setLocale("it-IT")}
>
Italiano
</GhostButton>
<GhostButton
className="w-full bg-[#35786f]"
onClick={() => setLocale("ug-CN")}
>
ئۇيغۇرچە
</GhostButton>
</div>
</div>
)}
</div></>
);
}