aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/@next/components/siteWrap.tsx
blob: 7529e90c9cb1098b055a0a78959fe2a7dfe4582e (plain) (blame)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import * as React from 'react';
import styled, { ThemeProvider } from 'styled-components';

import { Footer } from 'ts/@next/components/footer';
import { Header } from 'ts/@next/components/header';
import { Main } from 'ts/@next/components/layout';
import { GlobalStyles } from 'ts/@next/constants/globalStyle';

// Note(ez): We'll define the theme and provide it via a prop
// e.g. theme dark/light/etc.
interface Props {
    theme?: 'dark' | 'light' | 'gray';
    children: any;
}

interface GlobalThemes {
    [key: string]: {
        bgColor: string;
        textColor: string;
    }
}

const GLOBAL_THEMES: GlobalThemes = {
    dark: {
        bgColor: '#000000',
        textColor: '#FFFFFF',
    },
    light: {
        bgColor: '#FFFFFF',
        textColor: '#000000',
    },
    gray: {
        bgColor: '#e0e0e0',
        textColor: '#000000',
    },
}

export const SiteWrap: React.StatelessComponent<Props> = props => {
    const {
        children,
        theme = 'dark',
    } = props;
    const currentTheme = GLOBAL_THEMES[theme];

    return (
        <>
            <ThemeProvider theme={currentTheme}>
                <>
                    <GlobalStyles />

                    <Header />

                    <Main>
                        { children }
                    </Main>

                    <Footer/>
                </>
            </ThemeProvider>
        </>
    );
};