-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
5018647
commit 2f55297
Showing
4 changed files
with
49 additions
and
3 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
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,5 @@ | ||
.breadcrumbs { | ||
display: flex; | ||
flex-direction: row; | ||
gap: 5px; | ||
} |
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,22 @@ | ||
import { useMatches } from "react-router-dom"; | ||
import './Breadcrumbs.css'; | ||
|
||
export function Breadcrumbs() { | ||
let matches = useMatches(); | ||
let crumbs = matches | ||
// first get rid of any matches that don't have handle and crumb | ||
.filter((match) => Boolean(match.handle?.crumb)) | ||
// now map them into an array of elements, passing the loader | ||
// data to each one | ||
.map((match) => match.handle.crumb(match.data)); | ||
|
||
return ( | ||
<ol className="breadcrumbs"> | ||
{crumbs.map((crumb, index) => ( | ||
<li key={index}>{crumb}</li> | ||
))} | ||
</ol> | ||
); | ||
} | ||
|
||
export default Breadcrumbs; |
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