aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorflu0r1ne <flu0r1ne@flu0r1ne.net>2023-09-06 19:53:23 -0500
committerflu0r1ne <flu0r1ne@flu0r1ne.net>2023-09-06 19:53:23 -0500
commitef4fb0a5277ee99bd0f1747b77e733ef7f02460d (patch)
tree2c7b306eaa814dedccb987a28a1cd050fdd94136 /templates
parenta66d6b395e22d6506319cc20b6dfab0e88cb0f39 (diff)
downloadhomepage-ef4fb0a5277ee99bd0f1747b77e733ef7f02460d.tar.xz
homepage-ef4fb0a5277ee99bd0f1747b77e733ef7f02460d.zip
Make BreadCrumbs domain agnostic
Diffstat (limited to 'templates')
-rw-r--r--templates/Default/index.tsx36
1 files changed, 4 insertions, 32 deletions
diff --git a/templates/Default/index.tsx b/templates/Default/index.tsx
index 6a307ab..ccfde4a 100644
--- a/templates/Default/index.tsx
+++ b/templates/Default/index.tsx
@@ -1,8 +1,8 @@
-import clsx from "clsx";
-import React, { FC } from "react";
-import { Breadcrumbs, LinkCrumb } from "../../components/Breadcrumbs";
+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';
export type DefaultPageProps = {
className?: string;
@@ -11,34 +11,6 @@ export type DefaultPageProps = {
children?: React.ReactChild;
};
-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: React.ReactNode }> = ({children}) => (
<span className={styles.date}><b>Last Updated: </b>{children}</span>
)
@@ -47,7 +19,7 @@ const DefaultPage : FC<DefaultPageProps> = ({className, lastUpdated, children, p
<Viewport
className={clsx(styles.viewportOverrides, className)}
>
- {path !== undefined ? <RelPath path={path!} /> : undefined}
+ {path !== undefined ? <PathCrumbs path={path!} /> : undefined}
{lastUpdated ? <LastUpdatedDate>{lastUpdated}</LastUpdatedDate> : undefined}
{children}
</Viewport>