Files
web/components/TempDesignSystem/Breadcrumbs/index.tsx
Bianca Widstam 8b66c16e17 Merged in feat/SW-903-breadcrumbs-select-hotel (pull request #924)
Feat/SW-903 breadcrumbs select hotel

* feat(SW-903): break out breadcrumbs component and add on select-hotel page

* feat(903): updated paths

* feat(903): fix padding and remove translations

* feat(903): fix type

* feat(903): refactor padding

* feat(903): refactor padding again

* feat(903): refactor

* feat(903): fix comments

* feat(903): rename content breadcrumbs back


Approved-by: Pontus Dreij
Approved-by: Erik Tiekstra
2024-11-21 07:28:39 +00:00

62 lines
1.9 KiB
TypeScript

import { HouseIcon } from "@/components/Icons"
import ChevronRightSmallIcon from "@/components/Icons/ChevronRightSmall"
import Link from "@/components/TempDesignSystem/Link"
import Footnote from "@/components/TempDesignSystem/Text/Footnote"
import styles from "./breadcrumbs.module.css"
import type { BreadcrumbsProps } from "@/components/TempDesignSystem/Breadcrumbs/breadcrumbs"
export default function Breadcrumbs({ breadcrumbs }: BreadcrumbsProps) {
if (!breadcrumbs?.length) {
return null
}
const homeBreadcrumb = breadcrumbs.shift()
return (
<nav className={styles.breadcrumbs}>
<ul className={styles.list}>
{homeBreadcrumb ? (
<li className={styles.listItem}>
<Link
className={styles.homeLink}
color="peach80"
href={homeBreadcrumb.href!}
variant="breadcrumb"
aria-label={homeBreadcrumb.title}
>
<HouseIcon width={16} height={16} color="peach80" />
</Link>
<ChevronRightSmallIcon aria-hidden="true" color="peach80" />
</li>
) : null}
{breadcrumbs.map((breadcrumb) => {
if (breadcrumb.href) {
return (
<li key={breadcrumb.uid} className={styles.listItem}>
<Link
color="peach80"
href={breadcrumb.href}
variant="breadcrumb"
>
{breadcrumb.title}
</Link>
<ChevronRightSmallIcon aria-hidden="true" color="peach80" />
</li>
)
}
return (
<li key={breadcrumb.uid} className={styles.listItem}>
<Footnote color="burgundy" type="bold">
{breadcrumb.title}
</Footnote>
</li>
)
})}
</ul>
</nav>
)
}