umami/components/layout/Layout.js

27 lines
698 B
JavaScript
Raw Normal View History

2020-07-17 08:03:38 +00:00
import React from 'react';
import Head from 'next/head';
2020-08-07 09:27:12 +00:00
import Header from 'components/layout/Header';
import Footer from 'components/layout/Footer';
2021-05-15 08:29:39 +00:00
import useLocale from 'hooks/useLocale';
2021-05-16 06:27:48 +00:00
import { rtlLocales } from 'lib/lang';
2020-07-17 08:03:38 +00:00
2020-08-18 00:23:46 +00:00
export default function Layout({ title, children, header = true, footer = true }) {
const { locale } = useLocale();
2021-05-26 01:51:50 +00:00
const dir = rtlLocales.includes(locale) ? 'rtl' : 'ltr';
2021-05-13 06:15:37 +00:00
2020-07-17 08:03:38 +00:00
return (
<>
2021-05-15 08:29:39 +00:00
<Head>
2020-07-17 08:03:38 +00:00
<title>umami{title && ` - ${title}`}</title>
</Head>
2021-05-13 06:15:37 +00:00
2020-08-07 05:03:02 +00:00
{header && <Header />}
2021-05-26 01:51:50 +00:00
<main className="container" dir={dir}>
2021-05-13 06:15:37 +00:00
{children}
</main>
2020-08-07 05:03:02 +00:00
{footer && <Footer />}
2021-05-26 01:51:50 +00:00
<div id="__modals" dir={dir} />
2020-07-17 08:03:38 +00:00
</>
);
}