From e2198ab5a2691d5815d41a0ccd6adcc71da42170 Mon Sep 17 00:00:00 2001 From: Judit Pacsai Date: Fri, 27 Oct 2023 15:07:59 +0200 Subject: [PATCH 1/2] feat: add shown state to Navbar #2 --- src/components/Navbar.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/Navbar.js b/src/components/Navbar.js index cd53712..5fc554f 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useState } from 'react'; import { Link, useLocation } from 'react-router-dom'; import "../includes/css/navbar.css" import logo from "../includes/images/aks.png" @@ -6,6 +6,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faLaptop,faCircleInfo, faContactBook, faHome, faLaptopCode, faTimeline } from '@fortawesome/free-solid-svg-icons'; const Navbar = () => { + const [isShown, setIsShown] = useState(false); + const location = useLocation(); @@ -35,7 +37,10 @@ const Navbar = () => { return (
-
+
setIsShown(true)} + onMouseLeave={() => setIsShown(false)} + className={"sticky navbar bg-slate-800 flex items-center md:justify-content-start md:items-start justify-between px-2 md:px-0 md:justify-center h-[80px] md:h-[100vh] shadow-sm md:shadow-lg shadow-gray-800" + (isShown ? ' shown-side' : 'hidden-side')}> From 9291cd9372e903cf5b46438fb2fc31e7bb2a44ed Mon Sep 17 00:00:00 2001 From: Judit Pacsai Date: Fri, 27 Oct 2023 17:57:54 +0200 Subject: [PATCH 2/2] style: changing component width #2 --- src/components/Navbar.js | 4 ++-- src/pages/Home.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Navbar.js b/src/components/Navbar.js index 5fc554f..fb0a2a5 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -36,11 +36,11 @@ const Navbar = () => { return ( -
+
setIsShown(true)} onMouseLeave={() => setIsShown(false)} - className={"sticky navbar bg-slate-800 flex items-center md:justify-content-start md:items-start justify-between px-2 md:px-0 md:justify-center h-[80px] md:h-[100vh] shadow-sm md:shadow-lg shadow-gray-800" + (isShown ? ' shown-side' : 'hidden-side')}> + className="sticky navbar bg-slate-800 flex items-center md:justify-content-start md:items-start justify-between px-2 md:px-0 md:justify-center h-[80px] md:h-[100vh] shadow-sm md:shadow-lg shadow-gray-800">