diff --git a/src/components/CardNav.css b/src/components/CardNav.css index 0596946..2e74161 100644 --- a/src/components/CardNav.css +++ b/src/components/CardNav.css @@ -83,11 +83,10 @@ display: flex; align-items: center; justify-content: center; - pointer-events: none; /* Laisse cliquer au travers si besoin */ + pointer-events: none; } .site-title { - /* Ou ta font perso */ font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; diff --git a/src/components/CardNav.jsx b/src/components/CardNav.tsx similarity index 81% rename from src/components/CardNav.jsx rename to src/components/CardNav.tsx index 1babbae..8d681c2 100644 --- a/src/components/CardNav.jsx +++ b/src/components/CardNav.tsx @@ -1,4 +1,4 @@ -import { +import React, { useLayoutEffect, useRef, useState, @@ -10,22 +10,34 @@ import { import { Link, useNavigate, useLocation } from "react-router-dom"; import { gsap } from "gsap"; import "./CardNav.css"; -import { mainMenuItems, projectMenuItems } from "./data/DataMenuItem"; -const InfiniteMenu = lazy(() => import("./InfiniteMenu")); +import { mainMenuItems, projectMenuItems, MenuItem } from "./data/DataMenuItem"; + +const InfiniteMenu = lazy( + () => import("./InfiniteMenu"), +) as React.ComponentType; const Lanyard = lazy(() => import("./Lanyard")); -const CardNav = ({ +interface CardNavProps { + logo?: string; + logoAlt?: string; + className?: string; + ease?: string; +} + +const CardNav: React.FC = ({ logo = "/images/logo.webp", logoAlt = "Esiah Logo", className = "", ease = "power3.out", }) => { - const [isHamburgerOpen, setIsHamburgerOpen] = useState(false); - const [isExpanded, setIsExpanded] = useState(false); - const [showLanyard, setShowLanyard] = useState(false); - const navRef = useRef(null); - const tlRef = useRef(null); + const [isHamburgerOpen, setIsHamburgerOpen] = useState(false); + const [isExpanded, setIsExpanded] = useState(false); + const [showLanyard, setShowLanyard] = useState(false); + + const navRef = useRef(null); + const tlRef = useRef(null); + const location = useLocation(); const navigate = useNavigate(); @@ -49,7 +61,7 @@ const CardNav = ({ } }; - const handleCardClick = (link) => { + const handleCardClick = (link: string) => { if (!link) return; const cleanLink = link.replace("_blank", "").trim(); if (link.includes("_blank") || cleanLink.startsWith("http")) { @@ -68,7 +80,7 @@ const CardNav = ({ } }; - const menuItems = useMemo(() => { + const menuItems: MenuItem[] = useMemo(() => { if (location.pathname.startsWith("/projects")) { return projectMenuItems; } @@ -93,7 +105,9 @@ const CardNav = ({ useLayoutEffect(() => { const tl = createTimeline(); tlRef.current = tl; - return () => tl?.kill(); + return () => { + tl?.kill(); + }; }, [createTimeline]); return ( @@ -130,7 +144,7 @@ const CardNav = ({ alt={logoAlt} className="nav-logo-img" onError={(e) => { - e.target.style.display = "none"; + (e.target as HTMLImageElement).style.display = "none"; }} /> @@ -146,7 +160,7 @@ const CardNav = ({ >

Echoes of the Last Stop

- Thriller game project in collaboration with my partner + Story-driven thriller game in collaboration with my partner made + with Unity & Aseprite