diff --git a/apps/scandic-web/components/Blocks/CardsGrid.tsx b/apps/scandic-web/components/Blocks/CardsGrid.tsx index 3a59ab71d..9463665bd 100644 --- a/apps/scandic-web/components/Blocks/CardsGrid.tsx +++ b/apps/scandic-web/components/Blocks/CardsGrid.tsx @@ -5,16 +5,28 @@ import { import InfoCard from "@/components/ContentType/StartPage/InfoCard" import { Section } from "@/components/Section" -import SectionHeader from "@/components/Section/Header/Deprecated" +import { SectionHeader } from "@/components/Section/Header" import Card from "@/components/TempDesignSystem/Card" import Grids from "@/components/TempDesignSystem/Grids" import LoyaltyCard from "@/components/TempDesignSystem/LoyaltyCard" import TeaserCard from "@/components/TempDesignSystem/TeaserCard" -import type { CardsGridProps } from "@/types/components/blocks/cardsGrid" +import type { CardsGrid as CardsGridBlock } from "@scandic-hotels/trpc/types/blocks" +import type { VariantProps } from "class-variance-authority" + +import type { headingVariants } from "@/components/Section/Header/headingVariants" import type { StackableGridProps } from "../TempDesignSystem/Grids/Stackable/stackable" -export default function CardsGrid({ cards_grid }: CardsGridProps) { +interface CardsGridProps extends Pick { + headingLevel?: "h1" | "h2" + headingTypography?: VariantProps["typography"] +} + +export default function CardsGrid({ + cards_grid, + headingLevel = "h2", + headingTypography = "Title/sm", +}: CardsGridProps) { let columns: StackableGridProps["columns"] switch (cards_grid.layout) { @@ -34,10 +46,10 @@ export default function CardsGrid({ cards_grid }: CardsGridProps) { return (
diff --git a/apps/scandic-web/components/Blocks/CarouselCards/index.tsx b/apps/scandic-web/components/Blocks/CarouselCards/index.tsx index ae99fc75f..043060954 100644 --- a/apps/scandic-web/components/Blocks/CarouselCards/index.tsx +++ b/apps/scandic-web/components/Blocks/CarouselCards/index.tsx @@ -5,15 +5,27 @@ import { useState } from "react" import { Carousel } from "@/components/Carousel" import ContentCard from "@/components/ContentCard" import { Section } from "@/components/Section" -import SectionHeader from "@/components/Section/Header/Deprecated" +import { SectionHeader } from "@/components/Section/Header" import SectionLink from "@/components/Section/Link" import TabFilters from "@/components/TabFilters" import styles from "./carouselCards.module.css" -import type { CarouselCardsProps } from "@/types/components/blocks/carouselCards" +import type { CarouselCards as CarouselCardsBlock } from "@scandic-hotels/trpc/types/blocks" +import type { VariantProps } from "class-variance-authority" -export default function CarouselCards({ carousel_cards }: CarouselCardsProps) { +import type { headingVariants } from "@/components/Section/Header/headingVariants" + +interface CarouselCardsProps + extends Pick { + headingLevel?: "h1" | "h2" + headingTypography?: VariantProps["typography"] +} +export default function CarouselCards({ + carousel_cards, + headingLevel = "h2", + headingTypography = "Title/sm", +}: CarouselCardsProps) { const { heading, preamble, @@ -37,10 +49,10 @@ export default function CarouselCards({ carousel_cards }: CarouselCardsProps) { return (
{filterCategories.length > 0 && activeFilter && ( diff --git a/apps/scandic-web/components/Blocks/FullWidthCampaign/fullWidthCampaign.module.css b/apps/scandic-web/components/Blocks/FullWidthCampaign/fullWidthCampaign.module.css index 29a19de84..423ddf2be 100644 --- a/apps/scandic-web/components/Blocks/FullWidthCampaign/fullWidthCampaign.module.css +++ b/apps/scandic-web/components/Blocks/FullWidthCampaign/fullWidthCampaign.module.css @@ -2,32 +2,27 @@ position: relative; overflow: hidden; height: 100vh; + + &::after { + content: ""; + position: absolute; + inset: 0; + background: linear-gradient( + 180deg, + rgba(0, 0, 0, 0) 0%, + rgba(0, 0, 0, 0.36) 50%, + rgba(0, 0, 0, 0.75) 100% + ); + pointer-events: none; + z-index: 1; + } } + .bodyText { text-align: center; color: var(--Base-Text-Inverted); } -.container::after { - content: ""; - position: absolute; - inset: 0; - background: linear-gradient( - 180deg, - rgba(0, 0, 0, 0) 0%, - rgba(0, 0, 0, 0.36) 50%, - rgba(0, 0, 0, 0.75) 100% - ); - pointer-events: none; - z-index: 1; -} - -@media screen and (min-width: 768px) { - .container { - height: 880px; - } -} - .content { position: absolute; inset: 0; @@ -54,16 +49,10 @@ gap: var(--Space-x1); } -.buttonWrapper { +.button { min-width: 180px; } -@media screen and (max-width: 767px) { - .buttonWrapper:not(:only-child) { - min-width: 135px; - } -} - .image { max-width: 100%; height: 100%; @@ -73,3 +62,15 @@ .scriptedText { display: inline-block; } + +@media screen and (max-width: 767px) { + .button:not(:only-child) { + min-width: 135px; + } +} + +@media screen and (min-width: 768px) { + .container { + height: 880px; + } +} diff --git a/apps/scandic-web/components/Blocks/FullWidthCampaign/index.tsx b/apps/scandic-web/components/Blocks/FullWidthCampaign/index.tsx index 99a7f12c6..2088fece1 100644 --- a/apps/scandic-web/components/Blocks/FullWidthCampaign/index.tsx +++ b/apps/scandic-web/components/Blocks/FullWidthCampaign/index.tsx @@ -1,7 +1,5 @@ +import ButtonLink from "@scandic-hotels/design-system/ButtonLink" import Image from "@scandic-hotels/design-system/Image" -import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" -import Link from "@scandic-hotels/design-system/OldDSLink" -import Title from "@scandic-hotels/design-system/Title" import { Typography } from "@scandic-hotels/design-system/Typography" import BiroScript from "@/components/TempDesignSystem/Text/BiroScript" @@ -12,10 +10,15 @@ import type { FullWidthCampaign } from "@/types/trpc/routers/contentstack/startP interface FullWidthCampaignProps { content: FullWidthCampaign + headingLevel?: "h1" | "h2" } -export default function FullWidthCampaign({ content }: FullWidthCampaignProps) { +export default function FullWidthCampaign({ + content, + headingLevel = "h2", +}: FullWidthCampaignProps) { const { background_image, primary_button, secondary_button } = content + const Hx = headingLevel return (
@@ -36,53 +39,38 @@ export default function FullWidthCampaign({ content }: FullWidthCampaignProps) {
- - {content.heading} - - -

{content.body_text}

+ + {content.heading} + + +

{content.body_text}

{content.has_primary_button ? ( - + {primary_button.title} + ) : null} {content.has_secondary_button ? ( - + {secondary_button.title} + ) : null}
diff --git a/apps/scandic-web/components/Blocks/JoinScandicFriends/index.tsx b/apps/scandic-web/components/Blocks/JoinScandicFriends/index.tsx index cf4b48d70..348e3a1c1 100644 --- a/apps/scandic-web/components/Blocks/JoinScandicFriends/index.tsx +++ b/apps/scandic-web/components/Blocks/JoinScandicFriends/index.tsx @@ -11,10 +11,12 @@ import type { JoinScandicFriends } from "@/types/trpc/routers/contentstack/start interface JoinScandicFriendsProps { content: JoinScandicFriends + headingLevel?: "h1" | "h2" } export default async function JoinScandicFriends({ content, + headingLevel = "h2", }: JoinScandicFriendsProps) { const isLoggedIn = await isLoggedInUser() if (isLoggedIn) { @@ -22,6 +24,7 @@ export default async function JoinScandicFriends({ } const { show_header, show_usp, usp, primary_button } = content + const Hx = headingLevel return (
@@ -49,7 +52,7 @@ export default async function JoinScandicFriends({ ) : null} -

{content.title}

+ {content.title}
) : null} diff --git a/apps/scandic-web/components/Blocks/index.tsx b/apps/scandic-web/components/Blocks/index.tsx index 4c53b1dfd..0f7b97d58 100644 --- a/apps/scandic-web/components/Blocks/index.tsx +++ b/apps/scandic-web/components/Blocks/index.tsx @@ -1,5 +1,3 @@ -import { Suspense } from "react" - import { JsonToHtml } from "@scandic-hotels/design-system/JsonToHtml" import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum" @@ -13,9 +11,7 @@ import UspGrid from "@/components/Blocks/UspGrid" import AccordionSection from "./Accordion" import CardGallery from "./CardGallery" import Essentials from "./Essentials" -import FullWidthCampaign from "./FullWidthCampaign" import HotelListing from "./HotelListing" -import JoinScandicFriends from "./JoinScandicFriends" import Table from "./Table" import type { BlocksProps } from "@/types/components/blocks" @@ -107,14 +103,6 @@ export default function Blocks({ blocks }: BlocksProps) { ) case BlocksEnums.block.UspGrid: return - case BlocksEnums.block.FullWidthCampaign: - return - case BlocksEnums.block.JoinScandicFriends: - return ( - - - - ) case BlocksEnums.block.Essentials: return default: diff --git a/apps/scandic-web/components/ContentType/StartPage/Blocks/blocks.module.css b/apps/scandic-web/components/ContentType/StartPage/Blocks/blocks.module.css new file mode 100644 index 000000000..0000ab48a --- /dev/null +++ b/apps/scandic-web/components/ContentType/StartPage/Blocks/blocks.module.css @@ -0,0 +1,17 @@ +.block { + margin-left: auto; + margin-right: auto; + max-width: var(--max-width-content); + width: 100%; + + &:empty { + display: none; + } +} + +@media screen and (min-width: 768px) { + .block { + padding-left: var(--Space-x5); + padding-right: var(--Space-x5); + } +} diff --git a/apps/scandic-web/components/ContentType/StartPage/Blocks/index.tsx b/apps/scandic-web/components/ContentType/StartPage/Blocks/index.tsx new file mode 100644 index 000000000..54d5f4dab --- /dev/null +++ b/apps/scandic-web/components/ContentType/StartPage/Blocks/index.tsx @@ -0,0 +1,62 @@ +import { Suspense } from "react" + +import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum" + +import CardsGrid from "@/components/Blocks/CardsGrid" +import CarouselCards from "@/components/Blocks/CarouselCards" +import FullWidthCampaign from "@/components/Blocks/FullWidthCampaign" +import JoinScandicFriends from "@/components/Blocks/JoinScandicFriends" + +import styles from "./blocks.module.css" + +import type { Block as StartPageBlock } from "@scandic-hotels/trpc/routers/contentstack/startPage/query" + +interface BlocksProps { + blocks: StartPageBlock[] +} + +export function Blocks({ blocks }: BlocksProps) { + return blocks.map((block, idx) => { + const headingLevel = idx === 0 ? "h1" : "h2" + + switch (block.typename) { + case BlocksEnums.block.CardsGrid: + return ( +
+ +
+ ) + case BlocksEnums.block.CarouselCards: + return ( +
+ +
+ ) + case BlocksEnums.block.FullWidthCampaign: + return ( + + ) + case BlocksEnums.block.JoinScandicFriends: + return ( + +
+ +
+
+ ) + default: + return null + } + }) +} diff --git a/apps/scandic-web/components/ContentType/StartPage/index.tsx b/apps/scandic-web/components/ContentType/StartPage/index.tsx index 8714b9662..dad638615 100644 --- a/apps/scandic-web/components/ContentType/StartPage/index.tsx +++ b/apps/scandic-web/components/ContentType/StartPage/index.tsx @@ -2,13 +2,11 @@ import { FloatingBookingWidget } from "@scandic-hotels/booking-flow/BookingWidge import Image from "@scandic-hotels/design-system/Image" import { Typography } from "@scandic-hotels/design-system/Typography" import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" -import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum" import { bookingFlowConfig } from "@/constants/bookingFlowConfig" import { getStartPage } from "@/lib/trpc/memoizedRequests" -import Blocks from "@/components/Blocks" -import FullWidthCampaign from "@/components/Blocks/FullWidthCampaign" +import { Blocks } from "@/components/ContentType/StartPage/Blocks" import { getLang } from "@/i18n/serverContext" import styles from "./startPage.module.css" @@ -34,7 +32,7 @@ export default async function StartPage({
{header.heading.length ? ( -

{header.heading}

+

{header.heading}

) : null}
- {blocks.map((block, index) => { - if (block.typename === BlocksEnums.block.FullWidthCampaign) { - return ( - - ) - } - - return ( -
- -
- ) - })} +
diff --git a/apps/scandic-web/components/ContentType/StartPage/startPage.module.css b/apps/scandic-web/components/ContentType/StartPage/startPage.module.css index 810206a0d..6543994d0 100644 --- a/apps/scandic-web/components/ContentType/StartPage/startPage.module.css +++ b/apps/scandic-web/components/ContentType/StartPage/startPage.module.css @@ -1,17 +1,17 @@ .header { height: 560px; position: relative; -} -.header:after { - content: ""; - background: linear-gradient( - 182deg, - rgba(38, 32, 30, 0.08) 13%, - rgba(77, 0, 27, 0.4) 100% - ); - position: absolute; - inset: 0; + &::after { + content: ""; + background: linear-gradient( + 182deg, + rgba(38, 32, 30, 0.08) 13%, + rgba(77, 0, 27, 0.4) 100% + ); + position: absolute; + inset: 0; + } } .headerContent { @@ -26,10 +26,8 @@ padding: var(--Space-x2) var(--Space-x2) var(--Space-x4); } -@media screen and (min-width: 768px) { - .headerContent { - grid-gap: var(--Space-x4); - } +.heading { + z-index: 1; } .topImage { @@ -42,23 +40,12 @@ padding: calc(var(--Space-x5) * 2) 0 calc(var(--Space-x5) * 4); } -.section:empty { - display: none; -} - -.section { - margin-left: auto; - margin-right: auto; - max-width: var(--max-width-content); - width: 100%; -} - @media screen and (min-width: 768px) { + .headerContent { + grid-gap: var(--Space-x4); + } + .main { gap: calc(var(--Space-x5) + var(--Space-x4)); } - .section { - padding-left: var(--Space-x5); - padding-right: var(--Space-x5); - } } diff --git a/apps/scandic-web/components/Section/Header/index.tsx b/apps/scandic-web/components/Section/Header/index.tsx index 9e009163f..d3986adc0 100644 --- a/apps/scandic-web/components/Section/Header/index.tsx +++ b/apps/scandic-web/components/Section/Header/index.tsx @@ -15,7 +15,7 @@ interface SectionHeaderProps VariantProps { heading?: string headingLevel?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" - preamble?: string + preamble?: string | null link?: { href: string text: string diff --git a/apps/scandic-web/types/components/blocks/cardsGrid.ts b/apps/scandic-web/types/components/blocks/cardsGrid.ts deleted file mode 100644 index 705c087fb..000000000 --- a/apps/scandic-web/types/components/blocks/cardsGrid.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { CardsGrid } from "@scandic-hotels/trpc/types/blocks" - -export interface CardsGridProps extends Pick {} diff --git a/apps/scandic-web/types/components/blocks/carouselCards.ts b/apps/scandic-web/types/components/blocks/carouselCards.ts deleted file mode 100644 index a90c55411..000000000 --- a/apps/scandic-web/types/components/blocks/carouselCards.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { CarouselCards } from "@scandic-hotels/trpc/types/blocks" - -export interface CarouselCardsProps - extends Pick {} diff --git a/apps/scandic-web/types/components/blocks/index.ts b/apps/scandic-web/types/components/blocks/index.ts index 2c8925765..05714050d 100644 --- a/apps/scandic-web/types/components/blocks/index.ts +++ b/apps/scandic-web/types/components/blocks/index.ts @@ -1,4 +1,3 @@ -import type { Block as StartPageBlock } from "@scandic-hotels/trpc/routers/contentstack/startPage/query" import type { Block as AccountPageBlock } from "@scandic-hotels/trpc/types/accountPage" import type { Block as CampaignOverviewPageBlock } from "@scandic-hotels/trpc/types/campaignOverviewPage" import type { Block as CampaignPageBlock } from "@scandic-hotels/trpc/types/campaignPage" @@ -20,7 +19,6 @@ type Blocks = | DestinationCountryPageBlock | DestinationOverviewPageBlock | LoyaltyPageBlock - | StartPageBlock | PromoCampaignPageBlock export interface BlocksProps {