feat: add Polish and English language switcher
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Moon, Sun, SunMoon } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useI18n } from "@/lib/i18n";
|
||||
|
||||
export function ThemeToggle() {
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const [isDark, setIsDark] = useState(false);
|
||||
const { t } = useI18n();
|
||||
|
||||
useEffect(() => {
|
||||
const root = document.documentElement;
|
||||
@@ -39,7 +41,7 @@ export function ThemeToggle() {
|
||||
<Button
|
||||
variant="icon"
|
||||
type="button"
|
||||
aria-label={!mounted ? "Zmień motyw" : isDark ? "Włącz jasny motyw" : "Włącz ciemny motyw"}
|
||||
aria-label={!mounted ? t("theme.change") : isDark ? t("theme.light") : t("theme.dark")}
|
||||
onClick={toggleTheme}
|
||||
>
|
||||
{!mounted ? <SunMoon className="size-4" /> : isDark ? <Sun className="size-4" /> : <Moon className="size-4" />}
|
||||
|
||||
Reference in New Issue
Block a user