mirror of
https://github.com/HugeFrog24/shakethefrog.git
synced 2026-04-30 23:02:17 +00:00
Skin
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useState, useRef, useEffect } from 'react';
|
||||
import { useLocale, useTranslations } from 'next-intl';
|
||||
import { useSearchParams } from 'next/navigation';
|
||||
import { Link } from '../../i18n/routing';
|
||||
import { GlobeAltIcon, ChevronDownIcon } from '@heroicons/react/24/outline';
|
||||
|
||||
@@ -15,9 +16,12 @@ interface LanguageOption {
|
||||
export function LanguageToggle() {
|
||||
const locale = useLocale() as Locale;
|
||||
const t = useTranslations('ui');
|
||||
const searchParams = useSearchParams();
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const dropdownRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const query = Object.fromEntries(searchParams);
|
||||
|
||||
const locales: Locale[] = ['en', 'de', 'ru', 'ka', 'ar'];
|
||||
|
||||
const languageOptions: LanguageOption[] = locales.map((code) => ({
|
||||
@@ -89,7 +93,7 @@ export function LanguageToggle() {
|
||||
{languageOptions.map((option) => (
|
||||
<Link
|
||||
key={option.code}
|
||||
href="/"
|
||||
href={{ pathname: '/', query }}
|
||||
locale={option.code}
|
||||
onClick={() => setIsOpen(false)}
|
||||
className={`w-full flex items-center gap-3 px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors ${
|
||||
|
||||
Reference in New Issue
Block a user