diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/Default/index.tsx | 36 |
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> |