forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add breadcrumbs to docs * change BreadcrumbLink to NextLink * Update src/components/docs/Breadcrumbs.tsx Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com> * Update src/components/docs/Breadcrumbs.tsx Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com>
- Loading branch information
1 parent
20c0a6b
commit 790cf04
Showing
3 changed files
with
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Breadcrumb, BreadcrumbItem, BreadcrumbLink } from '@chakra-ui/react'; | ||
import NextLink from 'next/link'; | ||
import { FC } from 'react'; | ||
|
||
interface Props { | ||
router: any; | ||
} | ||
|
||
export const Breadcrumbs: FC<Props> = ({ router }) => { | ||
let pathSplit = router.asPath.split('/'); | ||
pathSplit = pathSplit.splice(1, pathSplit.length); | ||
|
||
return ( | ||
<Breadcrumb mb={10}> | ||
{pathSplit.map((path: string, idx: number) => { | ||
return ( | ||
<BreadcrumbItem key={path}> | ||
<NextLink href={`/${pathSplit.slice(0, idx + 1).join('/')}`} passHref> | ||
<BreadcrumbLink color={idx + 1 === pathSplit.length ? 'body' : 'primary'}> | ||
{path} | ||
</BreadcrumbLink> | ||
</NextLink> | ||
</BreadcrumbItem> | ||
); | ||
})} | ||
</Breadcrumb> | ||
); | ||
}; |
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 @@ | ||
export * from './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