From 369f16e78ea958c9a536ea4ee7791ad9d469a770 Mon Sep 17 00:00:00 2001 From: Nidboj132 Date: Sat, 6 May 2023 16:10:49 +0200 Subject: login test --- frontend/src/components/sidebar.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'frontend/src/components/sidebar.js') diff --git a/frontend/src/components/sidebar.js b/frontend/src/components/sidebar.js index d5a55fd..aaaf196 100644 --- a/frontend/src/components/sidebar.js +++ b/frontend/src/components/sidebar.js @@ -13,8 +13,9 @@ import img6 from "../imgs/6.png" import img7 from "../imgs/7.png" import img8 from "../imgs/8.png" import img9 from "../imgs/9.png" +import Login from "./login.js" -export default function Sidebar(x) { +export default function Sidebar() { // Locks search button for 300ms before it can be clicked again, prevents spam const [isLocked, setIsLocked] = React.useState(false); @@ -48,13 +49,18 @@ function SidebarHide(){ const btn = document.querySelectorAll("button"); const span = document.querySelectorAll("button>span"); const side = document.querySelector("#sidebar-list"); +const login = document.querySelectorAll(".login>button")[1]; if(sidebar===1){ setSidebar(0) side.style.width="320px" btn.forEach((e, i) =>{ e.style.width="310px" - setTimeout(() => {span[i].style.opacity="1"}, 100) + setTimeout(() => { + span[i].style.opacity="1" + login.style.opacity="1" + + }, 100) }) side.style.zIndex="2" } else { @@ -64,10 +70,14 @@ if(sidebar===1){ e.style.width="40px" span[i].style.opacity="0" }) - setTimeout(() => {side.style.zIndex="0"}, 300); + login.style.opacity="0" + setTimeout(() => { + side.style.zIndex="0" + }, 300); } } +// Links const location = useLocation() React.useEffect(()=>{ if(location.pathname==="/"){SidebarClick(1)} @@ -77,12 +87,14 @@ React.useEffect(()=>{ if(location.pathname.includes("discussions")){SidebarClick(5)} if(location.pathname.includes("scorelog")){SidebarClick(6)} if(location.pathname.includes("profile")){SidebarClick(7)} - if(location.pathname.includes("rules")){SidebarClick(8)} - if(location.pathname.includes("about")){SidebarClick(9)} + if(location.pathname.includes("rules")){SidebarClick(9)} + if(location.pathname.includes("about")){SidebarClick(10)} + // console.log(location.pathname) // eslint-disable-next-line react-hooks/exhaustive-deps }, [location]) + return (