Initial commit

This commit is contained in:
Iceberg
2026-04-20 17:59:24 +00:00
commit a43f8de3e4
51 changed files with 9695 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
'use client';
import { useState } from 'react';
import { useLocale } from 'next-intl';
import { useRouter, usePathname } from '@/i18n/navigation';
import { locales } from '@/i18n/routing';
export function LocaleSwitcher() {
const locale = useLocale();
const router = useRouter();
const pathname = usePathname();
const [currentLocale, setCurrentLocale] = useState(locale);
function switchLocale(next: string) {
setCurrentLocale(next);
router.replace(pathname, { locale: next });
}
return (
<div className="flex items-center gap-2 w-full py-2 hover:opacity-80">
<img
src={`/flags/${currentLocale}.svg`}
alt={currentLocale}
className="w-5 h-5 rounded-sm object-cover"
/>
<select
value={currentLocale}
onChange={(e) => switchLocale(e.target.value)}
className="bg-transparent text-current cursor-pointer outline-none w-full"
>
{locales.map(({ code, label }) => (
<option value={code} key={code}>
{label}
</option>
))}
</select>
</div>
);
}