noogle/website/components/layout/layout.tsx

135 lines
3.3 KiB
TypeScript
Raw Normal View History

import {
Box,
Typography,
Container,
Link,
IconButton,
2022-12-12 16:24:16 +03:00
Tooltip,
useMediaQuery,
useTheme,
} from "@mui/material";
2022-11-27 16:16:52 +03:00
import { Image } from "../image";
import nixSnowflake from "../../public/nix-snowflake.svg";
2022-12-03 19:38:50 +03:00
import nixWhite from "../../public/white.svg";
import GitHubIcon from "@mui/icons-material/GitHub";
2022-11-26 12:36:08 +03:00
export interface LayoutProps {
children: React.ReactNode;
}
export const useMobile = () => useMediaQuery(useTheme().breakpoints.down("md"));
2022-11-26 12:36:08 +03:00
export function Layout(props: LayoutProps) {
const { children } = props;
2022-11-27 16:16:52 +03:00
const theme = useTheme();
2022-11-26 12:36:08 +03:00
return (
2022-11-27 16:16:52 +03:00
<Box
sx={{
2022-12-03 19:38:50 +03:00
height: "100vh",
2022-12-12 16:24:16 +03:00
overflow: "scroll",
2022-11-27 16:16:52 +03:00
bgcolor:
2022-12-12 16:24:16 +03:00
theme.palette.mode === "light" ? "rgb(242, 248, 253)" : "#070c16",
2022-11-27 16:16:52 +03:00
}}
>
2022-12-03 19:38:50 +03:00
<header>
2022-11-27 16:16:52 +03:00
<Box
sx={{
height: "100%",
width: "100%",
zIndex: 0,
opacity: 0.1,
backgroundImage: `url(${nixSnowflake.src})`,
backgroundPositionX: "50%",
backgroundRepeat: "no-repeat",
}}
/>
<Box
sx={{
2022-12-03 19:38:50 +03:00
width: "100%",
p: 1,
zIndex: 1,
borderBottomRightRadius: 16,
borderBottomLeftRadius: 16,
2022-11-27 16:16:52 +03:00
backgroundColor:
theme.palette.mode === "light"
? "primary.main"
: "background.paper",
}}
>
<Typography
2022-12-12 16:24:16 +03:00
variant="h1"
component="h1"
2022-11-27 16:16:52 +03:00
sx={{
textAlign: "center",
color: "#fff",
2022-12-12 16:24:16 +03:00
fontSize: "30pt",
lineHeight: 1.2,
2022-11-27 16:16:52 +03:00
}}
>
<Box
sx={{
display: {
xs: "none",
2022-12-03 19:38:50 +03:00
md: "inline-block",
},
2022-11-27 16:16:52 +03:00
}}
2022-12-03 19:38:50 +03:00
component="span"
>
<Image
2022-12-03 19:38:50 +03:00
src={nixWhite}
alt="nix-logo"
2022-12-12 16:24:16 +03:00
height={25}
style={{
2022-12-12 16:24:16 +03:00
marginBottom: "0rem",
}}
/>
</Box>
2022-11-27 16:16:52 +03:00
<Box sx={{ ml: 1 }} component="span">{`noog\u03BBe`}</Box>
<Link href="https://github.com/hsjobeki/noogle" target="_blank">
2022-12-12 16:24:16 +03:00
<Tooltip title="Contribute on Github">
<IconButton
sx={{ float: "right", top: "0.6rem", right: "1em", p: 0 }}
>
<GitHubIcon
sx={{
display: {
xs: "none",
md: "inline-block",
},
}}
/>
</IconButton>
</Tooltip>
2022-12-03 19:38:50 +03:00
</Link>
2022-11-26 12:36:08 +03:00
</Typography>
</Box>
</header>
2022-12-03 19:38:50 +03:00
<main
style={{
2022-12-12 16:24:16 +03:00
marginTop: "1rem",
2022-12-03 19:38:50 +03:00
}}
>
<Container sx={{ pt: 0, px: { xs: 0, md: 2 } }} maxWidth="xl">
2022-11-26 12:36:08 +03:00
{children}
</Container>
</main>
<footer
style={{
position: "fixed",
bottom: 0,
display: "flex",
justifyContent: "center",
width: "100%",
}}
>
Powered by{" "}
<Link sx={{ ml: 1 }} href="https://oceansprint.org/">
{" "}
OceanSprint
</Link>
</footer>
2022-11-27 16:16:52 +03:00
</Box>
2022-11-26 12:36:08 +03:00
);
}