-
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.
style: apply formatter & improve import paths (#254)
- Loading branch information
Showing
10 changed files
with
59 additions
and
44 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,4 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
import { useMatches } from "react-router-dom"; | ||
import { useMatches } from 'react-router-dom'; | ||
|
||
import classes from './breadcrumbs.module.css'; | ||
|
||
function Breadcrumbs() { | ||
const matches = useMatches(); | ||
const 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)); | ||
const matches = useMatches(); | ||
const 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={classes.breadcrumbs}> | ||
{crumbs.map((crumb, index) => ( | ||
// eslint-disable-next-line react/no-array-index-key | ||
<li className={classes.crumb} key={index}>{crumb}</li> | ||
))} | ||
</ol> | ||
); | ||
return ( | ||
<div className="container mx-auto px-4"> | ||
<ol className={classes.breadcrumbs}> | ||
{crumbs.map((crumb, index) => ( | ||
// eslint-disable-next-line react/no-array-index-key | ||
<li className={classes.crumb} key={index}> | ||
{crumb} | ||
</li> | ||
))} | ||
</ol> | ||
</div> | ||
); | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
.breadcrumbs { | ||
display: flex; | ||
flex-direction: row; | ||
gap: .4rem; | ||
display: flex; | ||
flex-direction: row; | ||
gap: 0.4rem; | ||
} | ||
|
||
.crumb { | ||
&::after { | ||
content: '>'; | ||
margin-left: .4rem; | ||
} | ||
&::after { | ||
content: '>'; | ||
margin-left: 0.4rem; | ||
} | ||
|
||
&:last-child { | ||
&::after { | ||
content: ''; | ||
} | ||
&:last-child { | ||
&::after { | ||
content: ''; | ||
} | ||
} | ||
} |
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