From 1184ffb84f4dbf2e2ef9de4ab7e2b2b65463920b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damla=20K=C3=B6ksal?= Date: Fri, 1 Jan 2021 20:52:14 +0300 Subject: [PATCH] [#36] fix: clicking twice problem solved. - Changed language links found in sidebar component to tags. --- components/layout/layout.component.jsx | 3 ++- .../layout/side-bar/side-bar.component.jsx | 4 ++-- components/menu-item/menu-item.component.jsx | 22 ++++++++++++++----- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/components/layout/layout.component.jsx b/components/layout/layout.component.jsx index cb6feed..4929f6e 100644 --- a/components/layout/layout.component.jsx +++ b/components/layout/layout.component.jsx @@ -13,11 +13,12 @@ export default function Layout({ children, data: { announcement, sidebar, navbar, footer }, }) { + const [isOpen, setIsOpen] = useState(false); + const isMobile = useMediaQuery({ query: "(max-width: 475px)" }); const isDesktopOrLaptop = useMediaQuery({ query: "(min-width: 1131px)", }); - const [isOpen, setIsOpen] = useState(false); useEffect(() => { if (typeof window !== "undefined") disableScrollBody(isOpen); diff --git a/components/layout/side-bar/side-bar.component.jsx b/components/layout/side-bar/side-bar.component.jsx index 517f9f1..7310ed4 100644 --- a/components/layout/side-bar/side-bar.component.jsx +++ b/components/layout/side-bar/side-bar.component.jsx @@ -21,10 +21,10 @@ export default function SideBar({ {factory.text} {catalog.text} {contact.text} - + {turkish.text} - + {english.text} diff --git a/components/menu-item/menu-item.component.jsx b/components/menu-item/menu-item.component.jsx index cf16f5b..8a39241 100644 --- a/components/menu-item/menu-item.component.jsx +++ b/components/menu-item/menu-item.component.jsx @@ -1,14 +1,24 @@ import Link from "next/link"; import styles from "./menu-item.module.scss"; -export default function MenuItem({ href, children, lang }) { +export default function MenuItem({ href, children, lang, refresh }) { // TODO: Ignore warning from here return ( -
  • - - {children} - -
  • + <> + {refresh ? ( +
  • + + {children} + +
  • + ) : ( +
  • + + {children} + +
  • + )} + ); } /* TODO: fix the bug about links */