From 0c29fec2e42dc7d412af34322fdb4a83c661673f Mon Sep 17 00:00:00 2001 From: Kichiyaki Date: Sun, 28 Jun 2020 13:48:43 +0200 Subject: [PATCH] add @material-ui/icons package, make Header more responsive --- package.json | 1 + src/components/Layout/Header.js | 70 ++++++++++++++++++++++++++++++--- yarn.lock | 7 ++++ 3 files changed, 72 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index f27d495..a9f87d3 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "author": "Dawid WysokiƄski ", "dependencies": { "@material-ui/core": "^4.10.2", + "@material-ui/icons": "^4.9.1", "@material-ui/styles": "^4.10.0", "gatsby": "^2.23.10", "gatsby-image": "^2.4.8", diff --git a/src/components/Layout/Header.js b/src/components/Layout/Header.js index b27d1be..61678df 100644 --- a/src/components/Layout/Header.js +++ b/src/components/Layout/Header.js @@ -1,7 +1,16 @@ -import React from "react"; +import React, { useState } from "react"; import { makeStyles } from "@material-ui/core/styles"; -import { AppBar, Toolbar, Typography, Container } from "@material-ui/core"; -import { Link } from "gatsby-theme-material-ui"; +import { + AppBar, + Toolbar, + Typography, + Container, + Hidden, + Menu, + MenuItem, +} from "@material-ui/core"; +import { Menu as MenuIcon } from "@material-ui/icons"; +import { Link, IconButton } from "gatsby-theme-material-ui"; const useStyles = makeStyles(() => ({ title: { @@ -15,8 +24,19 @@ const useStyles = makeStyles(() => ({ })); function Header({ title, twhelpUrl }) { + const [anchorEl, setAnchorEl] = useState(null); const classes = useStyles(); + const open = Boolean(anchorEl); const twhelpText = twhelpUrl.replace("http://", "").replace("https://", ""); + + const handleMenuOpen = event => { + setAnchorEl(event.currentTarget); + }; + + const handleMenuClose = () => { + setAnchorEl(null); + }; + return ( @@ -27,9 +47,47 @@ function Header({ title, twhelpUrl }) {
- - {twhelpText} - + + + {twhelpText} + + + + + + + + + + {twhelpText} + + + +
diff --git a/yarn.lock b/yarn.lock index 81524f8..c98b8f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1612,6 +1612,13 @@ react-is "^16.8.0" react-transition-group "^4.4.0" +"@material-ui/icons@^4.9.1": + version "4.9.1" + resolved "https://registry.yarnpkg.com/@material-ui/icons/-/icons-4.9.1.tgz#fdeadf8cb3d89208945b33dbc50c7c616d0bd665" + integrity sha512-GBitL3oBWO0hzBhvA9KxqcowRUsA0qzwKkURyC8nppnC3fw54KPKZ+d4V1Eeg/UnDRSzDaI9nGCdel/eh9AQMg== + dependencies: + "@babel/runtime" "^7.4.4" + "@material-ui/styles@^4.10.0": version "4.10.0" resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.10.0.tgz#2406dc23aa358217aa8cc772e6237bd7f0544071"