-
Notifications
You must be signed in to change notification settings - Fork 1
/
masterpage.tsx
43 lines (39 loc) · 1.21 KB
/
masterpage.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
import React, {FC, PropsWithChildren} from 'react'
import {CSSObject, Global} from '@emotion/react'
import Head from 'next/head'
import {DefaultTemplate, EmptyTemplate} from '@/app/components/masterpages/templates'
import {siteDescription, siteName} from '@/app/dictionaries/site.dictionary'
interface IMasterPageProps {
bodyCss?: CSSObject
description?: string
subtitle?: string | string[]
template?: 'default' | 'empty'
title?: string
}
const MasterPage: FC<PropsWithChildren<IMasterPageProps>> = ({
bodyCss,
description = siteDescription,
children,
subtitle,
template = 'default',
title = siteName,
}) => {
return (
<>
<Head>
<title>{[...(subtitle ? [subtitle] : []), title].flat().join(' - ')}</title>
<meta name="description" content={description} key="meta-description" />
<link rel="icon" href="/favicon.ico" />
{/* Generate your complete favicon using https://realfavicongenerator.net/ */}
</Head>
<Global styles={{body: bodyCss}} />
{
{
default: <DefaultTemplate>{children}</DefaultTemplate>,
empty: <EmptyTemplate>{children}</EmptyTemplate>,
}[template]
}
</>
)
}
export default MasterPage