From f1f25f4764dd8d297a59765b0df85f55da2b39ee Mon Sep 17 00:00:00 2001
From: flu0r1ne <flu0r1ne@flu0r1ne.net>
Date: Mon, 19 Jul 2021 21:08:50 -0500
Subject: Init

---
 components/Breadcrumbs/index.tsx | 50 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 components/Breadcrumbs/index.tsx

(limited to 'components/Breadcrumbs/index.tsx')

diff --git a/components/Breadcrumbs/index.tsx b/components/Breadcrumbs/index.tsx
new file mode 100644
index 0000000..ed650e3
--- /dev/null
+++ b/components/Breadcrumbs/index.tsx
@@ -0,0 +1,50 @@
+import React, { Children, FC } from "react";
+import Link from "next/link";
+import styles from './breadcrumbs.module.scss';
+import clsx from 'clsx';
+
+export type BreadcrumbsProps = {
+    className?: string;
+    style?: object;
+};
+
+const Breadcrumbs : FC<BreadcrumbsProps> = ({children, className, ...props}) => (
+    <div className={clsx(styles.breadcrumbs, className)} {...props}>
+        {Children.map(children, (child, index) => {
+            return (
+                <>
+                    {
+                        index !== 0 ? (
+                            <span className={styles.divider}>/</span>
+                        ) : undefined
+                    }
+                    {child}
+                </>
+            );
+        })}
+    </div>
+);
+
+const Crumb : FC = ({children, ...props}) => (
+    <span className={styles.crumb} {...props}>
+        {children}
+    </span>
+);
+
+export type LinkCrumbProps = {
+    href: string;
+}
+
+const LinkCrumb : FC<LinkCrumbProps> = ({children, href, ...props}) => (
+    <Crumb>
+        <Link href={href}>
+            <a>{children}</a>
+        </Link>
+    </Crumb>
+);
+
+export {
+    Crumb,
+    Breadcrumbs,
+    LinkCrumb
+};
\ No newline at end of file
-- 
cgit v1.2.3

