import React from 'react';
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: 768px)');

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

export default NavBar;
