-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vth): add breadcrumb to content page
- Loading branch information
Showing
9 changed files
with
1,548 additions
and
1,946 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
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
76 changes: 76 additions & 0 deletions
76
apps/vth-frontend/src/components/BreadcrumbNavigation/index.tsx
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,76 @@ | ||
import Link from 'next/link'; | ||
import { FC, useId } from 'react'; | ||
import { UtrechtIconChevronRight } from '../Icons'; | ||
import clsx from 'clsx'; | ||
|
||
export type BreadcrumbNavigationElement = { | ||
title: string; | ||
href: string; | ||
isCurrent?: boolean; | ||
}; | ||
|
||
type BreadcrumbNavigationProps = { | ||
navigationElements: BreadcrumbNavigationElement[]; | ||
}; | ||
|
||
export const BreadcrumbNavigation: FC<BreadcrumbNavigationProps> = ({ navigationElements }) => { | ||
const labelId = useId(); | ||
|
||
return ( | ||
<nav className="utrecht-breadcrumb-nav utrecht-breadcrumb-nav--html-ol" aria-labelledby={labelId}> | ||
<h2 className="utrecht-heading-2 utrecht-breadcrumb-nav__heading" id={labelId} aria-hidden="true"> | ||
Kruimelpad: | ||
</h2> | ||
<ol | ||
className="utrecht-breadcrumb-nav__list utrecht-breadcrumb-nav__list--html-ol" | ||
itemType="https://schema.org/BreadcrumbList" | ||
> | ||
<li className="utrecht-breadcrumb-nav__item" itemType="https://schema.org/ListItem" itemProp="itemListElement"> | ||
<Link | ||
href="/" | ||
className="utrecht-link utrecht-link--html-a utrecht-breadcrumb-nav__link" | ||
rel="home" | ||
itemProp="item" | ||
> | ||
<span className="utrecht-breadcrumb-nav__text" itemProp="name"> | ||
Home | ||
</span> | ||
<meta itemProp="position" content="1" /> | ||
</Link> | ||
</li> | ||
{navigationElements?.map(({ title, href, isCurrent }, index) => ( | ||
<> | ||
<li | ||
key={`breadcrumb-separator-${index}`} | ||
aria-hidden="true" | ||
className="utrecht-breadcrumb-nav__separator utrecht-breadcrumb-nav__separator--html-li" | ||
> | ||
<UtrechtIconChevronRight /> | ||
</li> | ||
<li | ||
key={`breadcrumb-item-${title}`} | ||
className="utrecht-breadcrumb-nav__item" | ||
itemType="https://schema.org/ListItem" | ||
itemProp="itemListElement" | ||
> | ||
<Link | ||
href={href} | ||
className={clsx('utrecht-link utrecht-link--html-a', 'utrecht-breadcrumb-nav__link', { | ||
['utrecht-breadcrumb-nav__link--current utrecht-breadcrumb-nav__link--disabled']: isCurrent, | ||
})} | ||
itemProp="item" | ||
aria-current={isCurrent ? 'page' : false} | ||
aria-disabled={isCurrent ? 'true' : false} | ||
> | ||
<span className="utrecht-breadcrumb-nav__text" itemProp="name"> | ||
{title} | ||
</span> | ||
<meta itemProp="position" content={`${index + 1}`} /> | ||
</Link> | ||
</li> | ||
</> | ||
))} | ||
</ol> | ||
</nav> | ||
); | ||
}; |
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,3 @@ | ||
'use client'; | ||
|
||
export { UtrechtIconChevronRight } from '@utrecht/web-component-library-react'; |
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
Oops, something went wrong.