-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathLayout.component.tsx
43 lines (38 loc) · 1.2 KB
/
Layout.component.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Imports
import { ReactNode } from 'react';
// Components
import Header from '@/components/Header/Header.component';
import PageTitle from './PageTitle.component';
import Footer from '@/components/Footer/Footer.component';
import Stickynav from '@/components/Footer/Stickynav.component';
interface ILayoutProps {
children?: ReactNode;
title: string;
}
/**
* Renders layout for each page. Also passes along the title to the Header component.
* @function Layout
* @param {ReactNode} children - Children to be rendered by Layout component
* @param {TTitle} title - Title for the page. Is set in <title>{title}</title>
* @returns {JSX.Element} - Rendered component
*/
const Layout = ({ children, title }: ILayoutProps) => {
return (
<div className="flex flex-col min-h-screen w-full mx-auto">
<Header title={title} />
{title === 'Hjem' ? (
<main className="flex-1 px-4 md:px-0">{children}</main>
) : (
<div className="container mx-auto px-6 flex-1">
<PageTitle title={title} />
<main>{children}</main>
</div>
)}
<div className="mt-auto">
<Footer />
<Stickynav />
</div>
</div>
);
};
export default Layout;