From 81b6ad9c4bee1bf5839f738bd3976dea8db3a30e Mon Sep 17 00:00:00 2001 From: Michael Hunteman Date: Sun, 3 Mar 2024 10:43:24 -0800 Subject: Use different navigation menus based on viewport --- src/components/NavBar.tsx | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) (limited to 'src/components/NavBar.tsx') diff --git a/src/components/NavBar.tsx b/src/components/NavBar.tsx index de40b4f..4e35d95 100644 --- a/src/components/NavBar.tsx +++ b/src/components/NavBar.tsx @@ -1,21 +1,11 @@ -import { useContext } from 'react'; import { Link } from 'react-router-dom'; -import { AppBar, Button, IconButton, Stack, Toolbar, Typography } from '@mui/material'; -import DarkModeIcon from '@mui/icons-material/DarkMode'; -import LightModeIcon from '@mui/icons-material/LightMode'; -import { useTheme } from '@mui/material/styles'; -import { ThemeContext } from '../ThemeContextProvider'; +import { AppBar, Toolbar, Typography } from '@mui/material'; +import useMediaQuery from '@mui/material/useMediaQuery'; +import Desktop from './Desktop'; +import Mobile from './Mobile'; function NavBar() { - const theme = useTheme(); - const { toggleColorMode } = useContext(ThemeContext); - - const pages = [ - { name: 'Schedule', to: '/schedule'}, - { name: 'RSVP', to: '/guest-login' }, - { name: 'Registry', to: '/registry' }, - { name: 'Admin', to: '/admin' } - ]; + const isMobile = useMediaQuery('(max-width: 1000px)'); return ( @@ -25,20 +15,11 @@ function NavBar() { component={Link} to="/" color="inherit" - sx={{ textDecoration: 'none' }} - > + sx={{ textDecoration: "none" }} + > Madison and Michael's Wedding - - {pages.map(page => ( - - ))} - - {theme.palette.mode === 'dark' ? : } - - + {isMobile ? : } ); -- cgit v1.2.3