moonstream/frontend/src/components/Navbar.js

36 wiersze
855 B
JavaScript
Czysty Zwykły widok Historia

2021-07-27 14:42:02 +00:00
import React, { Suspense, useContext } from "react";
2021-07-13 11:35:46 +00:00
import { Flex } from "@chakra-ui/react";
import UIContext from "../core/providers/UIProvider/context";
import LandingNavbar from "./LandingNavbar";
2021-07-13 11:35:46 +00:00
const AppNavbar = React.lazy(() => import("./AppNavbar"));
const Navbar = () => {
const { isAppView, isLoggedIn } = useContext(UIContext);
2021-07-13 11:35:46 +00:00
return (
<Flex
boxShadow={["sm", "md"]}
zIndex={1}
2021-07-13 11:35:46 +00:00
alignItems="center"
id="Navbar"
2021-08-26 13:18:31 +00:00
minH="3rem"
maxH="3rem"
bgColor="blue.1200"
2021-08-26 13:18:31 +00:00
direction="row"
2021-07-13 11:35:46 +00:00
w="100%"
overflow="hidden"
position={"fixed"}
transition={"0.3s"}
top={"0"}
2021-07-13 11:35:46 +00:00
>
{(!isAppView || !isLoggedIn) && <LandingNavbar />}
2021-07-13 11:35:46 +00:00
<Suspense fallback={""}>
{isAppView && isLoggedIn && <AppNavbar />}
</Suspense>
</Flex>
);
};
export default Navbar;