Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react navbar material ui

import React from "react";
import {
  AppBar,
  Toolbar,
  CssBaseline,
  Typography,
  makeStyles,
  useTheme,
  useMediaQuery,
} from "@material-ui/core";
import { Link } from "react-router-dom";
import DrawerComponent from "./Drawer";

const useStyles = makeStyles((theme) => ({
  navlinks: {
    marginLeft: theme.spacing(5),
    display: "flex",
  },
  logo: {
    flexGrow: "1",
    cursor: "pointer",
  },
  link: {
    textDecoration: "none",
    color: "white",
    fontSize: "20px",
    marginLeft: theme.spacing(20),
    "&:hover": {
      color: "yellow",
      borderBottom: "1px solid white",
    },
  },
}));

function Navbar() {
  const classes = useStyles();
  const theme = useTheme();
  const isMobile = useMediaQuery(theme.breakpoints.down("md"));

  return (
    <AppBar position="static">
      <CssBaseline />
      <Toolbar>
        <Typography variant="h4" className={classes.logo}>
          Navbar
          
        </Typography>
        {isMobile ? (
          <DrawerComponent />
        ) : (
          <div className={classes.navlinks}>
            <Link to="/" className={classes.link}>
              Home
            </Link>
            <Link to="/about" className={classes.link}>
              About
            </Link>
            <Link to="/contact" className={classes.link}>
              Contact
            </Link>
            <Link to="/faq" className={classes.link}>
              FAQ
            </Link>
          </div>
        )}
      </Toolbar>
    </AppBar>
  );
}
export default Navbar;
Comment

material ui navbar

import React, { useState } from 'react';
import { makeStyles } from '@material-ui/core/styles';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import IconButton from '@material-ui/core/IconButton';
import Button from '@material-ui/core/Button';
import MenuIcon from '@material-ui/icons/Menu';
import ModalDialog from './ModalDialog';

const useStyles = makeStyles(theme => ({
  menuButton: {
    marginRight: theme.spacing(2),
  },
  title: {
    flexGrow: 1,
  },
}));

const Navbar = () => {
  const classes = useStyles();
  const [open, setOpen] = useState(false);

  const handleOpen = () => {
    setOpen(true);
  };

  const handleClose = () => {
    setOpen(false);
  };

  return (
    <AppBar position="static">
      <Toolbar>
        <IconButton
          edge="start"
          color="inherit"
          aria-label="menu"
          className={classes.menuButton}
        >
          <MenuIcon />
        </IconButton>
        <Typography variant="h6" className={classes.title}>
          Title
        </Typography>
        <Button color="inherit" onClick={handleOpen}>
          Signup
        </Button>
      </Toolbar>
      <ModalDialog open={open} handleClose={handleClose} />
    </AppBar>
  );
};

export default Navbar;
Comment

PREVIOUS NEXT
Code Example
Javascript :: angular json and cli json file 
Javascript :: unexpected token w in json at position 0 
Javascript :: scrollview pull to refresh react native 
Javascript :: convert c# to javascript online 
Javascript :: usestate previous state 
Javascript :: useformik checkbox multiselect 
Javascript :: jade cdn 
Javascript :: .yarnrc.yml get node module back 
Javascript :: jquery deferred 
Javascript :: summernote mentions ajax 
Javascript :: Object Property Shorthand javascript 
Javascript :: javascript timeline 
Javascript :: check uncek react-bootstrap-table reactjs 
Javascript :: chrome storage local update 
Javascript :: React S3 Bucket 
Javascript :: pug iterate array 
Javascript :: how to change object property value in javascript 
Javascript :: coreui react change background color 
Javascript :: $[name] in jquery 
Javascript :: selectores de jquery 
Javascript :: loop over a nerber in react 
Javascript :: vue method 
Javascript :: How to add click event to table row js 
Javascript :: how to install react fullpage using npm 
Javascript :: props in classes 
Javascript :: javascript catch all click events 
Javascript :: javascript dom after a element 
Javascript :: toastify js 
Javascript :: sequelize date format 
Javascript :: decode jwt token without library 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =