-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a16184
commit fa31a00
Showing
11 changed files
with
119 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.root { | ||
padding: 0.75rem 1rem; | ||
background: var(--colorPrimaryShade); | ||
color: var(--colorElevationLow); | ||
|
||
.crumbs { | ||
display: inline-flex; | ||
align-items: center; | ||
gap: 0.5rem; | ||
padding: 0 1rem; | ||
|
||
.crumb { | ||
color: inherit; | ||
text-transform: uppercase; | ||
font-size: 0.9em; | ||
|
||
&:last-child { | ||
font-weight: bold; | ||
} | ||
} | ||
|
||
.chevron { | ||
opacity: 0.5; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { faChevronRight } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import React, { ReactElement } from "react"; | ||
import { Link, useLocation } from "react-router-dom"; | ||
import styles from "./Breadcrumbs.module.scss"; | ||
|
||
const Breadcrumbs = (): ReactElement => { | ||
const location = useLocation(); | ||
|
||
const crumbs = location.pathname.split("/").filter((crumb) => !!crumb); | ||
|
||
const crumbElements = []; | ||
let link = ""; | ||
|
||
for (let i = 0; i < crumbs.length; i++) { | ||
link += `/${crumbs[i]}`; | ||
|
||
crumbElements.push( | ||
<Link to={link} key={i} className={styles.crumb}> | ||
{crumbs[i]} | ||
</Link> | ||
); | ||
|
||
if (i < crumbs.length - 1) { | ||
crumbElements.push( | ||
<FontAwesomeIcon | ||
key={`chevron-${i}`} | ||
className={styles.chevron} | ||
icon={faChevronRight} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
return ( | ||
<div className={styles.root}> | ||
<span className={styles.crumbs}>{crumbElements}</span> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Breadcrumbs; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters