blob: f693da2484bf109585b69af3c3613599b75979bc (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
import clsx from "clsx";
import React, { FC } from "react";
import { Breadcrumbs, LinkCrumb } from "../../components/Breadcrumbs";
import Viewport from "../../components/ViewPort";
import styles from './default.module.scss';
export type DefaultPage = {
className?: string;
path?: string;
lastUpdated?: string;
};
export type RelPathProps = {
path: string;
};
const RelPath : FC<RelPathProps> = ({path, ...props}) => {
const _path = path[path.length - 1] === '/' ? path.substr(0, path.length - 1) : path;
const parts = _path.split('/');
const rels = [''];
for(let i = 1; i < parts.length; i++) {
rels.push([rels[i - 1], parts[i]].join('/'));
}
rels[0] = '/';
parts[0] = 'flu0r1ne.net';
return (
<Breadcrumbs>
{rels.map((relHref, i) => (
<LinkCrumb key={relHref} href={relHref}>
{parts[i]}
</LinkCrumb>
))}
</Breadcrumbs>
);
}
const LastUpdatedDate : FC = ({children}) => (
<span className={styles.date}><b>Last Updated: </b>{children}</span>
)
const DefaultPage : FC<DefaultPage> = ({className, lastUpdated, children, path, ...props}) => (
<Viewport
className={clsx(styles.viewportOverrides, className)}
>
{path !== undefined ? <RelPath path={path!} /> : undefined}
{lastUpdated ? <LastUpdatedDate>{lastUpdated}</LastUpdatedDate> : undefined}
{children}
</Viewport>
);
export default DefaultPage;
|