From 28fc7a075cb5da7aa066a2aad5559c5426248dfc Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Mon, 14 Apr 2025 00:25:32 -0700 Subject: initial frontend site --- site/src/components/TitleBar.tsx | 119 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 site/src/components/TitleBar.tsx (limited to 'site/src/components/TitleBar.tsx') diff --git a/site/src/components/TitleBar.tsx b/site/src/components/TitleBar.tsx new file mode 100644 index 0000000..bf79191 --- /dev/null +++ b/site/src/components/TitleBar.tsx @@ -0,0 +1,119 @@ +import { Link } from 'react-router-dom'; +import { useState, useEffect, useRef } from 'react'; + +interface GameCategory { + name: string; + games: { id: string; title: string }[]; +} + +const TitleBar: React.FC = () => { + const [dropdownOpen, setDropdownOpen] = useState(false); + const dropdownRef = useRef(null); + + const gameCategories: GameCategory[] = [ + { + name: "KONAMI", + games: [ + { id: "sdvx", title: "SOUND VOLTEX" }, + { id: "iidx", title: "beatmania IIDX" }, + ] + }, + { + name: "SEGA", + games: [ + { id: "chunithm_jp", title: "CHUNITHM JPN" }, + ] + } + ]; + + useEffect(() => { + const handleClickOutside = (event: MouseEvent) => { + if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) { + setDropdownOpen(false); + } + }; + + if (dropdownOpen) { + document.addEventListener('mousedown', handleClickOutside); + } + + return () => { + document.removeEventListener('mousedown', handleClickOutside); + }; + }, [dropdownOpen]); + + return ( +
+
+
+
+ 573 Updates Logo +
+ 573 +
+ + {/* Site Title */} + + UPDATES + +
+ + {/* Navigation Section */} +
+ + All Games + + + {/* Dropdown Menu */} +
+ + + {dropdownOpen && ( +
+
+ {gameCategories.map((category, index) => ( +
+
+ {category.name} +
+
+ {category.games.map((game) => ( + setDropdownOpen(false)} + > + {game.title} + + ))} +
+
+ ))} +
+
+ )} +
+
+
+
+
+ ); +}; + +export default TitleBar; \ No newline at end of file -- cgit v1.2.3