diff --git a/frontend/package.json b/frontend/package.json index e8d8ad3..93736e0 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,6 +12,7 @@ "fix-format": "prettier --write src" }, "dependencies": { + "@heroicons/react": "^2.1.3", "autoprefixer": "^10.4.19", "postcss": "^8.4.38", "react": "^18.2.0", diff --git a/frontend/src/Navbar.tsx b/frontend/src/Navbar.tsx deleted file mode 100644 index 753ba46..0000000 --- a/frontend/src/Navbar.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import './index.css'; - -function Navbar() { - return
Navbar
; -} - -export default Navbar; diff --git a/frontend/src/library/Navbar.tsx b/frontend/src/library/Navbar.tsx new file mode 100644 index 0000000..2fd6400 --- /dev/null +++ b/frontend/src/library/Navbar.tsx @@ -0,0 +1,50 @@ +import { Link } from 'react-router-dom'; +import { useState } from 'react'; +import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/solid'; +import { NavbarLink } from '../pages/AppLayout'; + +function NavbarItem({ link }: { link: NavbarLink }) { + return ( + + {link.label} + + ); +} + +function Navbar({ links }: { links: NavbarLink[] }) { + const [menuOpen, setMenuOpen] = useState(false); + + return ( +
+
+ UNO +
+
+ {links.map((link, index) => ( + + ))} +
+
+ +
+ {menuOpen && ( +
+ {links.map((link, index) => ( + + ))} +
+ )} +
+ ); +} + +export default Navbar; diff --git a/frontend/src/pages/AppLayout.tsx b/frontend/src/pages/AppLayout.tsx index 26aaa2e..e8e77e5 100644 --- a/frontend/src/pages/AppLayout.tsx +++ b/frontend/src/pages/AppLayout.tsx @@ -1,10 +1,19 @@ import { Outlet } from 'react-router-dom'; -import Navbar from '../Navbar'; +import Navbar from '../library/Navbar'; + +export type NavbarLink = { + path: string; + label: string; +}; function AppLayout() { + const links: NavbarLink[] = [ + { path: '/about', label: 'About' }, + { path: '/play', label: 'Play' }, + ]; return (
- + {/* todo: Add a footer component */}