2022-12-13 04:45:38 +01:00
|
|
|
import { Container } from 'react-basics';
|
2020-07-17 10:03:38 +02:00
|
|
|
import Head from 'next/head';
|
2023-01-19 00:05:39 +01:00
|
|
|
import NavBar from 'components/layout/NavBar';
|
2023-01-11 23:47:38 +01:00
|
|
|
import useRequireLogin from 'hooks/useRequireLogin';
|
2023-01-19 00:05:39 +01:00
|
|
|
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 (
|
2023-01-19 00:05:39 +01:00
|
|
|
<div className={styles.layout}>
|
2021-05-15 10:29:39 +02:00
|
|
|
<Head>
|
2022-12-13 04:45:38 +01:00
|
|
|
<title>{title ? `${title} | umami` : 'umami'}</title>
|
2020-07-17 10:03:38 +02:00
|
|
|
</Head>
|
2023-01-19 00:05:39 +01:00
|
|
|
<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
|
|
|
);
|
|
|
|
}
|