mirror of https://github.com/ethereum/go-ethereum
Add breadcrumbs to docs (#37)
* 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>pull/26459/head^2
parent
20c0a6b2b3
commit
790cf04347
@ -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> |
||||||
|
); |
||||||
|
}; |
@ -0,0 +1 @@ |
|||||||
|
export * from './Breadcrumbs' |
Loading…
Reference in new issue