front-hub/src/components/Navbar/Navbar.tsx

31 lines
722 B
TypeScript
Raw Normal View History

2023-08-07 13:36:59 +00:00
import { Box, useMediaQuery, useTheme } from "@mui/material";
2022-11-21 18:19:51 +00:00
import NavbarCollapsed from "./NavbarCollapsed";
import NavbarFull from "./NavbarFull";
2022-11-21 17:53:16 +00:00
2023-08-02 08:31:58 +00:00
import type { ReactNode } from "react";
2022-11-21 17:53:16 +00:00
interface Props {
2023-05-26 11:19:10 +00:00
isLoggedIn: boolean;
2023-08-02 08:31:58 +00:00
children: ReactNode;
2022-11-21 17:53:16 +00:00
}
2023-08-02 08:31:58 +00:00
export default function Navbar({ isLoggedIn, children }: Props) {
2023-05-26 11:19:10 +00:00
const theme = useTheme();
2023-08-23 09:27:57 +00:00
const upMd = useMediaQuery(theme.breakpoints.up(1000));
2023-05-17 11:20:11 +00:00
2023-08-02 08:31:58 +00:00
return (
2023-08-07 13:36:59 +00:00
<Box
sx={{
paddingTop: upMd ? "80px" : 0,
width: "100%",
}}
>
2023-08-02 08:31:58 +00:00
{upMd ? (
<NavbarFull isLoggedIn={isLoggedIn}>{children}</NavbarFull>
) : (
<NavbarCollapsed isLoggedIn={isLoggedIn}>{children}</NavbarCollapsed>
)}
2023-08-07 13:36:59 +00:00
</Box>
2023-08-02 08:31:58 +00:00
);
2023-03-27 12:45:44 +00:00
}