aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorflu0r1ne <flu0r1ne@flu0r1ne.net>2021-07-19 21:08:50 -0500
committerflu0r1ne <flu0r1ne@flu0r1ne.net>2021-07-19 21:08:50 -0500
commitf1f25f4764dd8d297a59765b0df85f55da2b39ee (patch)
tree9c10f3fcde264a1b13dccc64b9037f46d9bbc121 /templates
downloadhomepage-f1f25f4764dd8d297a59765b0df85f55da2b39ee.tar.xz
homepage-f1f25f4764dd8d297a59765b0df85f55da2b39ee.zip
Init
Diffstat (limited to 'templates')
-rw-r--r--templates/Default/default.module.scss4
-rw-r--r--templates/Default/index.tsx49
-rw-r--r--templates/MarkdownPage/index.tsx20
3 files changed, 73 insertions, 0 deletions
diff --git a/templates/Default/default.module.scss b/templates/Default/default.module.scss
new file mode 100644
index 0000000..ba6096f
--- /dev/null
+++ b/templates/Default/default.module.scss
@@ -0,0 +1,4 @@
+.viewportOverrides {
+ margin-top: 4em;
+ margin-bottom: 3em;
+} \ No newline at end of file
diff --git a/templates/Default/index.tsx b/templates/Default/index.tsx
new file mode 100644
index 0000000..8902bf8
--- /dev/null
+++ b/templates/Default/index.tsx
@@ -0,0 +1,49 @@
+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;
+};
+
+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 DefaultPage : FC<DefaultPage> = ({className, children, path, ...props}) => (
+ <Viewport
+ className={clsx(styles.viewportOverrides, className)}
+ >
+ {path !== undefined ? <RelPath path={path!} /> : undefined}
+ {children}
+ </Viewport>
+);
+
+export default DefaultPage; \ No newline at end of file
diff --git a/templates/MarkdownPage/index.tsx b/templates/MarkdownPage/index.tsx
new file mode 100644
index 0000000..22b531e
--- /dev/null
+++ b/templates/MarkdownPage/index.tsx
@@ -0,0 +1,20 @@
+import React, { FC } from "react";
+import Markdown from "../../components/Markdown";
+import DefaultPage from "../Default";
+
+export type Props = {
+ path?: string;
+ md: string;
+};
+
+const MarkdownPage : FC<Props> = ({path, md, ...props}) => (
+ <DefaultPage
+ path={path}
+ >
+ <Markdown
+ md={md}
+ />
+ </DefaultPage>
+);
+
+export default MarkdownPage; \ No newline at end of file