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
This commit is contained in:
Bianca Widstam
2024-11-21 07:28:39 +00:00
parent 55bf718045
commit 8b66c16e17
15 changed files with 137 additions and 59 deletions

View File

@@ -1,60 +1,13 @@
import { serverClient } from "@/lib/trpc/server"
import { ChevronRightSmallIcon,HouseIcon } from "@/components/Icons"
import Link from "@/components/TempDesignSystem/Link"
import Footnote from "@/components/TempDesignSystem/Text/Footnote"
import styles from "./breadcrumbs.module.css"
import BreadcrumbsComp from "@/components/TempDesignSystem/Breadcrumbs"
export default async function Breadcrumbs() {
const breadcrumbs = await serverClient().contentstack.breadcrumbs.get()
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"
>
<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>
)
return <BreadcrumbsComp breadcrumbs={breadcrumbs} />
}