diff --git a/frontend/src/components/LandingNavbar.js b/frontend/src/components/LandingNavbar.js index ced9ae0d..c1afb174 100644 --- a/frontend/src/components/LandingNavbar.js +++ b/frontend/src/components/LandingNavbar.js @@ -6,15 +6,10 @@ import { Image, ButtonGroup, Spacer, - Menu, - MenuButton, - MenuList, - MenuItem, - MenuGroup, - MenuDivider, Link, + IconButton, } from "@chakra-ui/react"; -import { ChevronDownIcon } from "@chakra-ui/icons"; +import { HamburgerIcon } from "@chakra-ui/icons"; import useModals from "../core/hooks/useModals"; import UIContext from "../core/providers/UIProvider/context"; import ChakraAccountIconButton from "./AccountIconButton"; @@ -24,134 +19,78 @@ const LandingNavbar = () => { const { toggleModal } = useModals(); return ( <> - {!ui.isMobileView && ( - - - - - bugout.dev - - - + <> + + + + bugout.dev + + + - + {!ui.isMobileView && ( + <> - {ui.isLoggedIn && ( - + + {ui.isLoggedIn && ( + + + + )} + {!ui.isLoggedIn && ( - - )} - {!ui.isLoggedIn && ( - - )} - {!ui.isLoggedIn && ( - - )} - {ui.isLoggedIn && } - - - )} - {ui.isMobileView && ( - - } - > - bugout.dev - - - - {ui.isLoggedIn && ( - - Open App - )} {!ui.isLoggedIn && ( - <> - toggleModal("register")}> - Sign Up - - toggleModal("login")}> - Login - - + )} - + {ui.isLoggedIn && } + + + )} + - - - Home - - - Pricing - - - Case study - - - Team - - - Events - - - - Blog - - - {/* */} - + {ui.isMobileView && ( + <> + ui.setSidebarToggled(!ui.sidebarToggled)} + icon={} + /> + )} ); diff --git a/frontend/src/components/Sidebar.js b/frontend/src/components/Sidebar.js index 70e60d88..cb0e994d 100644 --- a/frontend/src/components/Sidebar.js +++ b/frontend/src/components/Sidebar.js @@ -59,31 +59,54 @@ const Sidebar = () => { /> - - - }> - {" "} - Stream - - - - }> - {" "} - Analytics - - - - }> - {" "} - Subscriptions - - - - - {/** - * You can add a footer for the sidebar ex: copyright - */} - + {ui.isLoggedIn && ( + + + }> + {" "} + Stream + + + + }> + {" "} + Analytics + + + + }> + {" "} + Subscriptions + + + + )} + {!ui.isLoggedIn && ( + + + { + ui.toggleModal("register"); + ui.setSidebarToggled(false); + }} + > + Sign up + + + + { + ui.toggleModal("login"); + ui.setSidebarToggled(false); + }} + > + Login + + + + )} + + ); }; diff --git a/frontend/src/core/providers/UIProvider/index.js b/frontend/src/core/providers/UIProvider/index.js index f418f494..58e17491 100644 --- a/frontend/src/core/providers/UIProvider/index.js +++ b/frontend/src/core/providers/UIProvider/index.js @@ -18,6 +18,15 @@ const UIProvider = ({ children }) => { "2xl": false, }); + const currentBreakpoint = useBreakpointValue({ + base: 0, + sm: 1, + md: 2, + lg: 3, + xl: 4, + "2xl": 5, + }); + const { modal, toggleModal } = useContext(ModalContext); const [searchTerm, setSearchTerm] = useQuery("q", " ", true, false); @@ -104,10 +113,27 @@ const UIProvider = ({ children }) => { useEffect(() => { if (isMobileView) { setSidebarVisible(true); + setSidebarCollapsed(false); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [isMobileView]); + //Sidebar is visible at at breakpoint value less then 2 + //Sidebar is visible always in appView + useEffect(() => { + if (currentBreakpoint < 2) { + setSidebarVisible(true); + setSidebarCollapsed(false); + } else { + if (!isAppView) { + setSidebarVisible(false); + } else { + setSidebarVisible(true); + } + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [currentBreakpoint, isAppView]); + // *********** Entries layout states ********************** /** diff --git a/frontend/src/layouts/AccountLayout.js b/frontend/src/layouts/AccountLayout.js index 2c80794a..3875414e 100644 --- a/frontend/src/layouts/AccountLayout.js +++ b/frontend/src/layouts/AccountLayout.js @@ -1,5 +1,4 @@ - -import { jsx } from "@emotion/react"; +import React from "@emotion/react"; import { Box } from "@chakra-ui/react"; import { getLayout as getSiteLayout } from "./AppLayout"; diff --git a/frontend/src/layouts/RootLayout.js b/frontend/src/layouts/RootLayout.js index c13d3757..b0f02a92 100644 --- a/frontend/src/layouts/RootLayout.js +++ b/frontend/src/layouts/RootLayout.js @@ -1,4 +1,3 @@ - import { jsx } from "@emotion/react"; import { Flex, Spinner } from "@chakra-ui/react"; import React, { Suspense, useContext, useState, useEffect } from "react"; @@ -30,7 +29,7 @@ const RootLayout = (props) => { maxH="100%" > - {ui.isAppView && ui.isLoggedIn && } +