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

26 lines
623 B
TypeScript
Raw Normal View History

2023-05-17 11:20:11 +00:00
import { 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();
const upMd = useMediaQuery(theme.breakpoints.up("md"));
2023-05-17 11:20:11 +00:00
2023-08-02 08:31:58 +00:00
return (
<>
{upMd ? (
<NavbarFull isLoggedIn={isLoggedIn}>{children}</NavbarFull>
) : (
<NavbarCollapsed isLoggedIn={isLoggedIn}>{children}</NavbarCollapsed>
)}
</>
);
2023-03-27 12:45:44 +00:00
}