umami/components/layout/AppLayout.js

30 lines
696 B
JavaScript
Raw Normal View History

import { Container } from 'react-basics';
2020-07-17 10:03:38 +02:00
import Head from 'next/head';
import NavBar from 'components/layout/NavBar';
2023-01-11 23:47:38 +01:00
import useRequireLogin from 'hooks/useRequireLogin';
import styles from './AppLayout.module.css';
2020-07-17 10:03:38 +02:00
2023-01-11 23:47:38 +01:00
export default function AppLayout({ title, children }) {
2023-01-31 06:44:07 +01:00
const { user } = useRequireLogin();
if (!user) {
return null;
}
2021-05-13 08:15:37 +02:00
2020-07-17 10:03:38 +02:00
return (
<div className={styles.layout}>
2021-05-15 10:29:39 +02:00
<Head>
<title>{title ? `${title} | umami` : 'umami'}</title>
2020-07-17 10:03:38 +02:00
</Head>
<div className={styles.nav}>
<NavBar />
</div>
<div className={styles.body}>
<Container>
<main>{children}</main>
</Container>
</div>
</div>
2020-07-17 10:03:38 +02:00
);
}