"use client"; import { useState } from "react"; import Nav from "./components/Nav"; import Projects from "./components/Projects"; import Info from "./components/Info"; import Contact from "./components/Contact"; import styles from "./page.module.css"; type OpenWindow = "projects" | "info" | "contact" | null; export default function Home() { const [openWindow, setOpenWindow] = useState(null); const handleNavClick = (e: React.MouseEvent) => { const icon = (e.target as HTMLElement).closest("a"); if (!icon) return; e.preventDefault(); const icons = Array.from( e.currentTarget.querySelectorAll("a") ); const index = icons.indexOf(icon); const windowByIndex: Record = { 0: "projects", 1: "info", 2: "contact", }; const nextWindow = windowByIndex[index] ?? null; setOpenWindow(prev => prev === nextWindow ? null : nextWindow ); }; return (
{openWindow === "projects" && } {openWindow === "info" && } {openWindow === "contact" && }
); }