aboutsummaryrefslogtreecommitdiff
path: root/components/Breadcrumbs
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 /components/Breadcrumbs
downloadhomepage-f1f25f4764dd8d297a59765b0df85f55da2b39ee.tar.xz
homepage-f1f25f4764dd8d297a59765b0df85f55da2b39ee.zip
Init
Diffstat (limited to 'components/Breadcrumbs')
-rw-r--r--components/Breadcrumbs/breadcrumbs.module.scss15
-rw-r--r--components/Breadcrumbs/index.tsx50
2 files changed, 65 insertions, 0 deletions
diff --git a/components/Breadcrumbs/breadcrumbs.module.scss b/components/Breadcrumbs/breadcrumbs.module.scss
new file mode 100644
index 0000000..104eec2
--- /dev/null
+++ b/components/Breadcrumbs/breadcrumbs.module.scss
@@ -0,0 +1,15 @@
+.crumb {
+ font-size: 1.10rem;
+}
+
+.divider {
+ font-size: 1.0rem;
+}
+
+.crumb {
+ align-content: center;
+}
+
+.divider {
+ margin: 0 0.3rem;
+} \ No newline at end of file
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