From 85a90baa1269189990535e1cb059375a146fc217 Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Mon, 7 Apr 2025 14:02:39 +0000 Subject: [PATCH] Merged in fix/SW-2118-breadcrumbs (pull request #1721) fix(SW-2118): changed variants for breadcrumbs to handle different background-colors and widths * fix(SW-2118): changed variants for breadcrumbs to handle different background-colors and widths Approved-by: Christian Andolf Approved-by: Linus Flood --- .../my-pages/@breadcrumbs/[...path]/page.tsx | 3 +- .../[contentType]/[uid]/@breadcrumbs/page.tsx | 23 ++++++++- .../components/Breadcrumbs/index.tsx | 10 ++-- .../DestinationCityPage/index.tsx | 6 +-- .../DestinationCountryPage/index.tsx | 6 +-- .../ContentType/HotelPage/index.tsx | 5 +- .../HotelSubpage/hotelSubpage.module.css | 1 - .../ContentType/HotelSubpage/index.tsx | 7 +-- .../StaticPages/ContentPage/index.tsx | 13 +++-- .../StaticPages/staticPage.module.css | 15 +----- .../Breadcrumbs/Breadcrumb.tsx | 12 +++-- .../Breadcrumbs/BreadcrumbsSkeleton/index.tsx | 22 ++++++--- .../Breadcrumbs/breadcrumbs.module.css | 48 ++++++++++++------- .../TempDesignSystem/Breadcrumbs/index.tsx | 44 +++++++++++------ .../TempDesignSystem/Breadcrumbs/utils.ts | 4 +- .../TempDesignSystem/Breadcrumbs/variants.ts | 27 +++++------ 16 files changed, 141 insertions(+), 105 deletions(-) diff --git a/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/@breadcrumbs/[...path]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/@breadcrumbs/[...path]/page.tsx index 564ca0b78..52bdc5a73 100644 --- a/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/@breadcrumbs/[...path]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/@breadcrumbs/[...path]/page.tsx @@ -4,12 +4,11 @@ import Breadcrumbs from "@/components/Breadcrumbs" import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton" import type { LangParams, PageArgs } from "@/types/params" -import { PageContentTypeEnum } from "@/types/requests/contentType" export default function AllBreadcrumbs({}: PageArgs) { return ( }> - + ) } diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/[contentType]/[uid]/@breadcrumbs/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/[contentType]/[uid]/@breadcrumbs/page.tsx index 8682a8b8f..2afed4d26 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/[contentType]/[uid]/@breadcrumbs/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/[contentType]/[uid]/@breadcrumbs/page.tsx @@ -5,14 +5,31 @@ import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/Bread import type { ContentTypeParams, LangParams, PageArgs } from "@/types/params" import { PageContentTypeEnum } from "@/types/requests/contentType" +import type { BreadcrumbsProps } from "@/components/TempDesignSystem/Breadcrumbs/breadcrumbs" +// This is a temporary solution to avoid showing breadcrumbs on certain content types. +// This should be refactored in the future to handle content types differently, similar to `destination_overview_page`. const IGNORED_CONTENT_TYPES = [ PageContentTypeEnum.hotelPage, PageContentTypeEnum.contentPage, PageContentTypeEnum.destinationCityPage, PageContentTypeEnum.destinationCountryPage, + PageContentTypeEnum.destinationOverviewPage, + PageContentTypeEnum.startPage, ] +// This function is temporary until the content types are refactored and handled differently, similar to `destination_overview_page`. +function getBreadcrumbsVariantsByContentType( + contentType: PageContentTypeEnum +): Pick | null { + switch (contentType) { + case PageContentTypeEnum.collectionPage: + return { color: "Surface/Secondary/Default", size: "contentWidth" } + default: + return null + } +} + export default function PageBreadcrumbs({ params, }: PageArgs) { @@ -20,9 +37,11 @@ export default function PageBreadcrumbs({ return null } + const variants = getBreadcrumbsVariantsByContentType(params.contentType) + return ( - }> - + }> + ) } diff --git a/apps/scandic-web/components/Breadcrumbs/index.tsx b/apps/scandic-web/components/Breadcrumbs/index.tsx index b804b31b5..f9295f75c 100644 --- a/apps/scandic-web/components/Breadcrumbs/index.tsx +++ b/apps/scandic-web/components/Breadcrumbs/index.tsx @@ -5,11 +5,15 @@ import { generateBreadcrumbsSchema } from "@/utils/jsonSchemas" import type { BreadcrumbsProps } from "@/components/TempDesignSystem/Breadcrumbs/breadcrumbs" -interface Props extends Pick { +interface Props extends Pick { subpageTitle?: string } -export default async function Breadcrumbs({ variant, subpageTitle }: Props) { +export default async function Breadcrumbs({ + color, + size, + subpageTitle, +}: Props) { const breadcrumbs = await serverClient().contentstack.breadcrumbs.get() if (!breadcrumbs?.length) { return null @@ -29,7 +33,7 @@ export default async function Breadcrumbs({ variant, subpageTitle }: Props) { __html: JSON.stringify(jsonSchema.jsonLd), }} /> - + ) } diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/index.tsx index 32e9b3895..633decbe3 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/index.tsx @@ -21,8 +21,6 @@ import DestinationCityPageSkeleton from "./DestinationCityPageSkeleton" import styles from "./destinationCityPage.module.css" -import { PageContentTypeEnum } from "@/types/requests/contentType" - export default async function DestinationCityPage() { const pageData = await getDestinationCityPage() @@ -51,9 +49,7 @@ export default async function DestinationCityPage() {
}> - + {images?.length ? ( diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/index.tsx index fb909975d..f3027261c 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/index.tsx @@ -18,8 +18,6 @@ import DestinationCountryPageSkeleton from "./DestinationCountryPageSkeleton" import styles from "./destinationCountryPage.module.css" -import { PageContentTypeEnum } from "@/types/requests/contentType" - export default async function DestinationCountryPage() { const pageData = await getDestinationCountryPage() @@ -48,9 +46,7 @@ export default async function DestinationCountryPage() {
}> - + {images?.length ? (
- }> - + }> + {images?.length ? ( diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/hotelSubpage.module.css b/apps/scandic-web/components/ContentType/HotelSubpage/hotelSubpage.module.css index 62f6abdef..5c42e2a40 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/hotelSubpage.module.css +++ b/apps/scandic-web/components/ContentType/HotelSubpage/hotelSubpage.module.css @@ -4,7 +4,6 @@ .header { display: grid; - gap: var(--Spacing-x4); background-color: var(--Base-Surface-Subtle-Normal); padding-bottom: var(--Spacing-x4); } diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/index.tsx b/apps/scandic-web/components/ContentType/HotelSubpage/index.tsx index c4b5bdbbd..95a240568 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelSubpage/index.tsx @@ -77,11 +77,8 @@ export default async function HotelSubpage({ )}
- }> - + }> + {pageData.heroImage ? ( diff --git a/apps/scandic-web/components/ContentType/StaticPages/ContentPage/index.tsx b/apps/scandic-web/components/ContentType/StaticPages/ContentPage/index.tsx index e506cc283..dcb715738 100644 --- a/apps/scandic-web/components/ContentType/StaticPages/ContentPage/index.tsx +++ b/apps/scandic-web/components/ContentType/StaticPages/ContentPage/index.tsx @@ -8,8 +8,6 @@ import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/Bread import StaticPage from ".." -import { PageContentTypeEnum } from "@/types/requests/contentType" - export default async function ContentPage() { const contentPageRes = await serverClient().contentstack.contentPage.get() @@ -26,8 +24,15 @@ export default async function ContentPage() { destination={contentPage.meeting_package.location} /> )} - }> - + + } + > + {href ? ( <> - - {children} - + + + {children} + + ) { + const classNames = breadcrumbsVariants({ color, size }) return ( -