From abd510457c38290e8cc40c37c8e737a3911cc4d9 Mon Sep 17 00:00:00 2001 From: Ruidy Nemausat Date: Thu, 6 Feb 2020 11:15:07 +0100 Subject: [PATCH] navbar done --- README.md | 3 +- src/components/Navbar.jsx | 14 ++++----- src/components/SideNav.jsx | 59 +++++++++++++++++++++----------------- src/pages/App.jsx | 4 +++ src/pages/Profile.jsx | 1 + 5 files changed, 45 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 6db1d24..1d151b8 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Free meal planner for cooks short on ideas! (like me …) - Notation system: know what are the most loved meals - Share recipe with your friends and family - Suggestions based on what your personal taste -- Recipes in Video +- Recipes in Video ✓ - Get a full menu (Starter, Main, Dessert + Cocktail) - Send a daily suggestion to newsletter - History @@ -95,7 +95,6 @@ Free meal planner for cooks short on ideas! (like me …) ## TO DO -1. add sidenav on mobile 1. send message after contact form validation (confirm to sender and msg+info to admin) 1. Design & Breadcrumb 1. Cookie bar diff --git a/src/components/Navbar.jsx b/src/components/Navbar.jsx index 2fa6a89..5537a49 100644 --- a/src/components/Navbar.jsx +++ b/src/components/Navbar.jsx @@ -1,4 +1,5 @@ import React from "react"; +import { Link } from "react-router-dom"; import { useAuth0 } from "../utils/auth0-spa"; import { Logo } from "./Logo"; import { RandomButton } from "./RandomButton"; @@ -20,7 +21,7 @@ export const Navbar = props => { {links.map((link, i) => ( ))} -
  • {isAuthenticated && }
  • + {isAuthenticated && }
  • {
  • {!isAuthenticated ? : }
  • - - menu - + menu + diff --git a/src/components/SideNav.jsx b/src/components/SideNav.jsx index 736ff1f..e19cbf2 100644 --- a/src/components/SideNav.jsx +++ b/src/components/SideNav.jsx @@ -1,6 +1,6 @@ -import React, { useState } from "react"; +import React from "react"; +import { Link } from "react-router-dom"; import { useAuth0 } from "../utils/auth0-spa"; -// import { Logo } from "./Logo"; import { RandomButton } from "./RandomButton"; import { FooterLink } from "./FooterLink"; import { LogInButton } from "./LogInButton"; @@ -8,7 +8,7 @@ import { LogOutButton } from "./LogOutButton"; export const SideNav = props => { const { showNav, closeNavClick, links } = props; - const { isAuthenticated } = useAuth0(); + const { isAuthenticated, user } = useAuth0(); let transformStyle = { transform: showNav ? "translateX(0%)" : "translateX(-105%)", transition: "0.5s" @@ -18,18 +18,14 @@ export const SideNav = props => { <> ); diff --git a/src/pages/App.jsx b/src/pages/App.jsx index f6f1dc4..cb2a99a 100644 --- a/src/pages/App.jsx +++ b/src/pages/App.jsx @@ -115,6 +115,7 @@ export const App = () => { ev.preventDefault(); setShowNav(true); document.addEventListener("keydown", handleEscKey); + // document.addEventListener("click", handleOutsideClick); }; const closeNavClick = ev => { ev.preventDefault(); @@ -126,6 +127,9 @@ export const App = () => { setShowNav(false); } }; + // const handleOutsideClick = ev => { + // console.log(ev); + // }; const links = ["categories", "contact"]; diff --git a/src/pages/Profile.jsx b/src/pages/Profile.jsx index 96251ec..40f6781 100644 --- a/src/pages/Profile.jsx +++ b/src/pages/Profile.jsx @@ -22,6 +22,7 @@ export const Profile = () => {

    Email: {user.email} + {/* {user.email} */}

    {/* {JSON.stringify(user, null, 2)} */}