aboutsummaryrefslogtreecommitdiff
path: root/templates/Default/index.tsx
blob: 1025703d5bffcb02bede8b500e7235130acfd2f9 (plain)
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
import React, { FC } from 'react';
import PathCrumbs from "../../components/PathCrumbs";
import Viewport from "../../components/ViewPort";
import styles from './default.module.scss';
import clsx from 'clsx';
import Typ from '../../components/Typ';
import Box from '../../components/Box';

export type DefaultPageProps = {
    className?: string;
    path?: string;
    lastUpdated?: string;
    children?: React.ReactChild;
};

const LastUpdatedDate : FC<{ children: React.ReactNode }> = ({children}) => (
    <span style={{ whiteSpace: 'nowrap', padding: '4px 0px' }} >Last Updated: {children}</span>
)

const DefaultPage : FC<DefaultPageProps> = ({className, lastUpdated, children, path, ...props}) => (
  <Viewport
      className={clsx(styles.viewportOverrides, className)}
      my={3}
  >
    <Box
      style={{ display: 'flex', justifyContent: 'space-between', flexWrap: 'wrap' }}
      el='header'
      my={1}
    >
      {path !== undefined ? <PathCrumbs style={{ padding: '4px 0px' }} path={path!} /> : undefined}
      {lastUpdated ? <LastUpdatedDate>{lastUpdated}</LastUpdatedDate> : undefined}
    </Box>
    <main>
      {children}
    </main>
  </Viewport>
);

export default DefaultPage;