From ef4fb0a5277ee99bd0f1747b77e733ef7f02460d Mon Sep 17 00:00:00 2001
From: flu0r1ne <flu0r1ne@flu0r1ne.net>
Date: Wed, 6 Sep 2023 19:53:23 -0500
Subject: Make BreadCrumbs domain agnostic

---
 templates/Default/index.tsx | 36 ++++--------------------------------
 1 file changed, 4 insertions(+), 32 deletions(-)

(limited to 'templates/Default/index.tsx')

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>
-- 
cgit v1.2.3

