diff --git a/src/App.tsx b/src/App.tsx index 61438bd0..e4f711fd 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -26,6 +26,9 @@ const asciiFiles = [ "cat-loaf.txt", ]; +const homeTabs = ["work", "travel"] as const; +type HomeTab = (typeof homeTabs)[number]; + function App() { return ( @@ -42,6 +45,7 @@ function Home() { const isDevMode = import.meta.env.VITE_PUBLIC_DEV === "1"; const navigate = useNavigate(); const [asciiArt, setAsciiArt] = useState(""); + const [activeTab, setActiveTab] = useState("work"); const [activeIndex, setActiveIndex] = useState(null); const [hasPointerInteraction, setHasPointerInteraction] = useState(false); const [asciiFile] = useState( @@ -82,6 +86,18 @@ function Home() { const handleKeyDown = (event: KeyboardEvent) => { if (event.defaultPrevented || event.isComposing) return; if (event.metaKey || event.ctrlKey || event.altKey) return; + + if (event.key === "Tab") { + event.preventDefault(); + setActiveTab((prev) => { + const currentIndex = homeTabs.indexOf(prev); + const safeIndex = currentIndex === -1 ? 0 : currentIndex; + const nextIndex = (safeIndex + 1) % homeTabs.length; + return homeTabs[nextIndex]; + }); + return; + } + if (isInteractiveTarget(event.target)) return; const key = event.key.length === 1 ? event.key.toLowerCase() : event.key; @@ -181,38 +197,41 @@ function Home() { Age: - - -
- {visibleProjects.map((project, index) => ( - - ))} -
-
- - test{" "} - + setActiveTab(value as HomeTab)} + className="w-full max-w-5xl gap-0" + > Work Travel - +
+ +
+ {visibleProjects.map((project, index) => ( + + ))} +
+
+ test +