Added multi-lingua, english-spanish. Timer conditions and Linting bugfixes.
Deploy NPM app / Deploy NPM (push) Successful in 29s

This commit is contained in:
Antoni Nuñez Romeu
2026-03-27 16:23:06 +01:00
parent 5b663be89f
commit 935921f698
22 changed files with 1220 additions and 509 deletions
+35 -3
View File
@@ -1,6 +1,7 @@
import { useState, useEffect } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { Menu, X } from "lucide-react";
import { Menu, X, Globe } from "lucide-react";
import { useTranslation } from "react-i18next";
import { NAV_LINKS } from "@/data/event-data";
import Logo from "@/assets/logo.png";
@@ -11,6 +12,12 @@ import Logo from "@/assets/logo.png";
const Navbar = () => {
const [scrolled, setScrolled] = useState(false);
const [menuOpen, setMenuOpen] = useState(false);
const { t, i18n } = useTranslation();
const toggleLanguage = () => {
const newLang = i18n.language === 'es' ? 'en' : 'es';
i18n.changeLanguage(newLang);
};
useEffect(() => {
const onScroll = () => setScrolled(window.scrollY > 50);
@@ -49,9 +56,21 @@ const Navbar = () => {
href={link.href}
className="text-sm font-medium text-black/80 hover:text-primary transition-colors"
>
{link.label}
{t(`nav.${link.href.substring(1)}`)}
</a>
))}
{/* Language Switcher */}
<button
onClick={toggleLanguage}
className="flex items-center gap-2 px-3 py-2 rounded-lg bg-primary/10 hover:bg-primary/20 transition-colors"
aria-label="Change language"
>
<Globe size={18} />
<span className="text-sm font-medium">
{i18n.language === 'es' ? 'EN' : 'ES'}
</span>
</button>
</div>
{/* Mobile toggle */}
@@ -85,9 +104,22 @@ const Navbar = () => {
onClick={() => setMenuOpen(false)}
className="text-3xl md:text-4xl lg:text-5xl pt-3 pb-6 break-words leading-[1.6] font-display font-medium text-foreground hover:text-primary transition-colors"
>
{link.label}
{t(`nav.${link.href.substring(1)}`)}
</motion.a>
))}
{/* Language Switcher */}
<motion.button
initial={{ opacity: 0, y: 30 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 30 }}
transition={{ delay: 0.1 * NAV_LINKS.length }}
onClick={toggleLanguage}
className="flex items-center gap-3 text-3xl md:text-4xl lg:text-5xl pt-3 pb-6 font-display font-medium text-foreground hover:text-primary transition-colors"
>
<Globe className="w-8 h-8 md:w-10 md:h-10" />
{i18n.language === 'es' ? 'EN' : 'ES'}
</motion.button>
</motion.div>
)}
</AnimatePresence>