kopia lustrzana https://github.com/bugout-dev/moonstream
sidebar/navbar updates
rodzic
34436a4bf2
commit
a82267abd6
|
@ -6,15 +6,10 @@ import {
|
||||||
Image,
|
Image,
|
||||||
ButtonGroup,
|
ButtonGroup,
|
||||||
Spacer,
|
Spacer,
|
||||||
Menu,
|
|
||||||
MenuButton,
|
|
||||||
MenuList,
|
|
||||||
MenuItem,
|
|
||||||
MenuGroup,
|
|
||||||
MenuDivider,
|
|
||||||
Link,
|
Link,
|
||||||
|
IconButton,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import { ChevronDownIcon } from "@chakra-ui/icons";
|
import { HamburgerIcon } from "@chakra-ui/icons";
|
||||||
import useModals from "../core/hooks/useModals";
|
import useModals from "../core/hooks/useModals";
|
||||||
import UIContext from "../core/providers/UIProvider/context";
|
import UIContext from "../core/providers/UIProvider/context";
|
||||||
import ChakraAccountIconButton from "./AccountIconButton";
|
import ChakraAccountIconButton from "./AccountIconButton";
|
||||||
|
@ -24,13 +19,12 @@ const LandingNavbar = () => {
|
||||||
const { toggleModal } = useModals();
|
const { toggleModal } = useModals();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!ui.isMobileView && (
|
<>
|
||||||
<Fragment>
|
<Flex position="absolute" left="calc(50% - 100px)">
|
||||||
<Flex pl="7%">
|
|
||||||
<RouterLink href="/" passHref>
|
<RouterLink href="/" passHref>
|
||||||
<Link>
|
<Link>
|
||||||
<Image
|
<Image
|
||||||
h="2rem"
|
w="200px"
|
||||||
src="/icons/bugout-dev-white.svg"
|
src="/icons/bugout-dev-white.svg"
|
||||||
alt="bugout.dev"
|
alt="bugout.dev"
|
||||||
/>
|
/>
|
||||||
|
@ -38,15 +32,15 @@ const LandingNavbar = () => {
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
{!ui.isMobileView && (
|
||||||
|
<>
|
||||||
|
<Spacer />
|
||||||
<ButtonGroup
|
<ButtonGroup
|
||||||
variant="link"
|
variant="link"
|
||||||
colorScheme="secondary"
|
colorScheme="secondary"
|
||||||
spacing={4}
|
spacing={4}
|
||||||
justifyContent="space-evenly"
|
|
||||||
width="100%"
|
|
||||||
pr={16}
|
pr={16}
|
||||||
>
|
>
|
||||||
<Spacer />
|
|
||||||
{ui.isLoggedIn && (
|
{ui.isLoggedIn && (
|
||||||
<RouterLink href="/stream" passHref>
|
<RouterLink href="/stream" passHref>
|
||||||
<Button
|
<Button
|
||||||
|
@ -84,74 +78,19 @@ const LandingNavbar = () => {
|
||||||
)}
|
)}
|
||||||
{ui.isLoggedIn && <ChakraAccountIconButton />}
|
{ui.isLoggedIn && <ChakraAccountIconButton />}
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</Fragment>
|
|
||||||
)}
|
|
||||||
{ui.isMobileView && (
|
|
||||||
<Menu>
|
|
||||||
<MenuButton
|
|
||||||
as={Button}
|
|
||||||
m={0}
|
|
||||||
variant="solid"
|
|
||||||
w={["100%", "100%", "18rem", "20rem", "22rem", "24rem"]}
|
|
||||||
p={3}
|
|
||||||
colorScheme="primary"
|
|
||||||
h="3rem"
|
|
||||||
borderRadius={0}
|
|
||||||
rightIcon={<ChevronDownIcon boxSize="1.5rem" />}
|
|
||||||
>
|
|
||||||
<Image
|
|
||||||
h="1.5rem"
|
|
||||||
src="/icons/bugout-dev-white.svg"
|
|
||||||
alt="bugout.dev"
|
|
||||||
/>
|
|
||||||
</MenuButton>
|
|
||||||
<MenuList
|
|
||||||
zIndex={100}
|
|
||||||
width={["100vw", "100vw", "18rem", "20rem", "22rem", "24rem"]}
|
|
||||||
borderRadius={0}
|
|
||||||
m={0}
|
|
||||||
>
|
|
||||||
<MenuGroup>
|
|
||||||
{ui.isLoggedIn && (
|
|
||||||
<RouterLink href="/stream" passHref>
|
|
||||||
<MenuItem bgColor="secondary.600">Open App</MenuItem>
|
|
||||||
</RouterLink>
|
|
||||||
)}
|
|
||||||
{!ui.isLoggedIn && (
|
|
||||||
<>
|
|
||||||
<MenuItem onClick={() => toggleModal("register")}>
|
|
||||||
Sign Up
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem onClick={() => toggleModal("login")}>
|
|
||||||
Login
|
|
||||||
</MenuItem>
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</MenuGroup>
|
</>
|
||||||
|
|
||||||
<MenuDivider />
|
{ui.isMobileView && (
|
||||||
<RouterLink href="/" passHref>
|
<>
|
||||||
<MenuItem>Home</MenuItem>
|
<IconButton
|
||||||
</RouterLink>
|
colorScheme="secondary"
|
||||||
<RouterLink href="/pricing" passHref>
|
variant="solid"
|
||||||
<MenuItem>Pricing</MenuItem>
|
onClick={() => ui.setSidebarToggled(!ui.sidebarToggled)}
|
||||||
</RouterLink>
|
icon={<HamburgerIcon />}
|
||||||
<RouterLink href="/case-studies/activeloop" passHref>
|
/>
|
||||||
<MenuItem>Case study</MenuItem>
|
</>
|
||||||
</RouterLink>
|
|
||||||
<RouterLink href="/team" passHref>
|
|
||||||
<MenuItem>Team</MenuItem>
|
|
||||||
</RouterLink>
|
|
||||||
<RouterLink href="/events" passHref>
|
|
||||||
<MenuItem>Events</MenuItem>
|
|
||||||
</RouterLink>
|
|
||||||
|
|
||||||
<MenuItem as="a" href="http://blog.bugout.dev">
|
|
||||||
Blog
|
|
||||||
</MenuItem>
|
|
||||||
</MenuList>
|
|
||||||
{/* <Box bg="pink" w={["15rem", "15rem", "15rem", "18rem", "20rem"]} h="100%"></Box> */}
|
|
||||||
</Menu>
|
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
@ -59,6 +59,7 @@ const Sidebar = () => {
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
</SidebarHeader>
|
</SidebarHeader>
|
||||||
|
{ui.isLoggedIn && (
|
||||||
<SidebarContent>
|
<SidebarContent>
|
||||||
<Menu iconShape="square">
|
<Menu iconShape="square">
|
||||||
<MenuItem icon={<MdTimeline />}>
|
<MenuItem icon={<MdTimeline />}>
|
||||||
|
@ -79,11 +80,33 @@ const Sidebar = () => {
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
</SidebarContent>
|
</SidebarContent>
|
||||||
<SidebarFooter>
|
)}
|
||||||
{/**
|
{!ui.isLoggedIn && (
|
||||||
* You can add a footer for the sidebar ex: copyright
|
<SidebarContent>
|
||||||
*/}
|
<Menu iconShape="square">
|
||||||
</SidebarFooter>
|
<MenuItem
|
||||||
|
onClick={() => {
|
||||||
|
ui.toggleModal("register");
|
||||||
|
ui.setSidebarToggled(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Sign up
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
<Menu iconShape="square">
|
||||||
|
<MenuItem
|
||||||
|
onClick={() => {
|
||||||
|
ui.toggleModal("login");
|
||||||
|
ui.setSidebarToggled(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Login
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
</SidebarContent>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<SidebarFooter></SidebarFooter>
|
||||||
</ProSidebar>
|
</ProSidebar>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,6 +18,15 @@ const UIProvider = ({ children }) => {
|
||||||
"2xl": false,
|
"2xl": false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const currentBreakpoint = useBreakpointValue({
|
||||||
|
base: 0,
|
||||||
|
sm: 1,
|
||||||
|
md: 2,
|
||||||
|
lg: 3,
|
||||||
|
xl: 4,
|
||||||
|
"2xl": 5,
|
||||||
|
});
|
||||||
|
|
||||||
const { modal, toggleModal } = useContext(ModalContext);
|
const { modal, toggleModal } = useContext(ModalContext);
|
||||||
const [searchTerm, setSearchTerm] = useQuery("q", " ", true, false);
|
const [searchTerm, setSearchTerm] = useQuery("q", " ", true, false);
|
||||||
|
|
||||||
|
@ -104,10 +113,27 @@ const UIProvider = ({ children }) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isMobileView) {
|
if (isMobileView) {
|
||||||
setSidebarVisible(true);
|
setSidebarVisible(true);
|
||||||
|
setSidebarCollapsed(false);
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [isMobileView]);
|
}, [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 **********************
|
// *********** Entries layout states **********************
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
import React from "@emotion/react";
|
||||||
import { jsx } from "@emotion/react";
|
|
||||||
import { Box } from "@chakra-ui/react";
|
import { Box } from "@chakra-ui/react";
|
||||||
import { getLayout as getSiteLayout } from "./AppLayout";
|
import { getLayout as getSiteLayout } from "./AppLayout";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import { jsx } from "@emotion/react";
|
import { jsx } from "@emotion/react";
|
||||||
import { Flex, Spinner } from "@chakra-ui/react";
|
import { Flex, Spinner } from "@chakra-ui/react";
|
||||||
import React, { Suspense, useContext, useState, useEffect } from "react";
|
import React, { Suspense, useContext, useState, useEffect } from "react";
|
||||||
|
@ -30,7 +29,7 @@ const RootLayout = (props) => {
|
||||||
maxH="100%"
|
maxH="100%"
|
||||||
>
|
>
|
||||||
<Suspense fallback="">
|
<Suspense fallback="">
|
||||||
{ui.isAppView && ui.isLoggedIn && <Sidebar />}
|
<Sidebar />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
<Flex
|
<Flex
|
||||||
direction="column"
|
direction="column"
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
background-color: white;
|
background-color: rgba(0, 0, 0, 0.3);
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue