forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits

locale-switcher.tsx25 lines, 920 bytesHistoryRawDownload
1import { usePreferences } from "@/stores/preferences-context";
2
3export function LocaleSwitcher() {
4 const prefs = usePreferences();
5 return (
6 <div class="flex items-center overflow-hidden rounded-md border border-border/70 bg-background/80 p-0.5">
7 <button
8 type="button"
9 class="flex items-center gap-1 rounded-sm px-2 py-1 text-xs font-medium transition-colors aria-pressed:bg-primary aria-pressed:text-primary-foreground"
10 aria-pressed={prefs.locale() === "tr"}
11 onClick={() => prefs.setLocale("tr")}
12 >
13 TR
14 </button>
15 <button
16 type="button"
17 class="flex items-center gap-1 rounded-sm px-2 py-1 text-xs font-medium transition-colors aria-pressed:bg-primary aria-pressed:text-primary-foreground"
18 aria-pressed={prefs.locale() === "en"}
19 onClick={() => prefs.setLocale("en")}
20 >
21 EN
22 </button>
23 </div>
24 );
25}