import { Link } from 'react-router-dom';
import { AppBar, Toolbar, Typography } from '@mui/material';
import useMediaQuery from '@mui/material/useMediaQuery';
import Desktop from './Desktop';
import Mobile from './Mobile';

function NavBar() {
  const isMobile = useMediaQuery('(max-width: 1000px)');

  return (
    <AppBar position="relative">
      <Toolbar>
        <Typography
          variant="h5"
          component={Link}
          to="/"
          color="inherit"
          sx={{ textDecoration: "none" }}
        >
          Madison and Michael's Wedding
        </Typography>
        {isMobile ? <Mobile /> : <Desktop />}
      </Toolbar>
    </AppBar>
  );
}

export default NavBar;
