📝 priettier check
All checks were successful
PR Checks / lint-and-build (pull_request) Successful in 18s

This commit is contained in:
RJ
2025-12-04 15:57:39 +02:00
parent b68325123b
commit 101624c4d5
32 changed files with 185 additions and 172 deletions

View File

@@ -1,6 +1,6 @@
'use client'
import {Link} from '@/i18n/navigation'
import { Link } from '@/i18n/navigation'
import { usePathname } from 'next/navigation'
import { useLocale, useTranslations } from 'next-intl'
import { Fragment } from 'react'

View File

@@ -1,21 +1,21 @@
'use client';
'use client'
import {useLocale} from 'next-intl';
import {useRouter, usePathname} from '@/i18n/navigation';
import {routing} from '@/i18n/routing';
import {useState} from 'react';
import { useLocale } from 'next-intl'
import { useRouter, usePathname } from '@/i18n/navigation'
import { routing } from '@/i18n/routing'
import { useState } from 'react'
export default function LanguageSwitcher() {
const locale = useLocale();
const router = useRouter();
const pathname = usePathname();
const [isOpen, setIsOpen] = useState(false);
const locale = useLocale()
const router = useRouter()
const pathname = usePathname()
const [isOpen, setIsOpen] = useState(false)
const handleLocaleChange = (newLocale: string) => {
router.replace(pathname, {locale: newLocale});
router.refresh();
setIsOpen(false);
};
router.replace(pathname, { locale: newLocale })
router.refresh()
setIsOpen(false)
}
return (
<div className="relative z-[100]">
@@ -36,9 +36,8 @@ export default function LanguageSwitcher() {
className={`
w-full text-left px-4 py-2 font-mono uppercase text-xs
border-b border-slate-700 last:border-b-0
${locale === loc
? 'bg-cyan-900 text-cyan-300'
: 'text-slate-400 hover:bg-slate-800'
${
locale === loc ? 'bg-cyan-900 text-cyan-300' : 'text-slate-400 hover:bg-slate-800'
}
`}
>
@@ -48,12 +47,7 @@ export default function LanguageSwitcher() {
</div>
)}
{isOpen && (
<div
className="fixed inset-0 z-40"
onClick={() => setIsOpen(false)}
/>
)}
{isOpen && <div className="fixed inset-0 z-40" onClick={() => setIsOpen(false)} />}
</div>
);
)
}