feat(SW-2973): Added bookingCode if available to links inside campaign pages
* feat(SW-2973): Moved block types to trpc lib Approved-by: Matilda Landström
This commit is contained in:
@@ -24,6 +24,7 @@ import styles from "./campaignHotelListing.module.css"
|
||||
interface CampaignHotelListingClientProps {
|
||||
heading: string
|
||||
preamble?: string | null
|
||||
bookingCode?: string | null
|
||||
visibleCountMobile: 3 | 6
|
||||
visibleCountDesktop: 3 | 6
|
||||
isMainBlock: boolean
|
||||
@@ -35,6 +36,7 @@ export default function CampaignHotelListingClient({
|
||||
visibleCountMobile,
|
||||
visibleCountDesktop,
|
||||
isMainBlock,
|
||||
bookingCode,
|
||||
}: CampaignHotelListingClientProps) {
|
||||
const intl = useIntl()
|
||||
const isMobile = useMediaQuery("(max-width: 767px)")
|
||||
@@ -119,16 +121,24 @@ export default function CampaignHotelListingClient({
|
||||
) : null}
|
||||
</header>
|
||||
<ul className={styles.list}>
|
||||
{activeHotels.map(({ hotel, url }, index) => (
|
||||
<li
|
||||
key={hotel.id}
|
||||
className={cx(styles.listItem, {
|
||||
[styles.hidden]: index >= visibleCount,
|
||||
})}
|
||||
>
|
||||
<HotelListingItem hotel={hotel} url={url} />
|
||||
</li>
|
||||
))}
|
||||
{activeHotels.map(({ hotel, url }, index) => {
|
||||
const urlWithOptionalBookingCode = bookingCode
|
||||
? `${url}?bookingCode=${bookingCode}`
|
||||
: url
|
||||
return (
|
||||
<li
|
||||
key={hotel.id}
|
||||
className={cx(styles.listItem, {
|
||||
[styles.hidden]: index >= visibleCount,
|
||||
})}
|
||||
>
|
||||
<HotelListingItem
|
||||
hotel={hotel}
|
||||
url={urlWithOptionalBookingCode}
|
||||
/>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
|
||||
{showButton ? (
|
||||
|
||||
@@ -19,6 +19,7 @@ interface CampaignHotelListingProps {
|
||||
heading: string
|
||||
preamble?: string | null
|
||||
hotelIds: string[]
|
||||
bookingCode?: string | null
|
||||
visibleCountMobile?: 3 | 6
|
||||
visibleCountDesktop?: 3 | 6
|
||||
isMainBlock?: boolean
|
||||
@@ -28,6 +29,7 @@ export default async function CampaignHotelListing({
|
||||
heading,
|
||||
preamble,
|
||||
hotelIds,
|
||||
bookingCode,
|
||||
visibleCountMobile = 3,
|
||||
visibleCountDesktop = 6,
|
||||
isMainBlock = false,
|
||||
@@ -66,6 +68,7 @@ export default async function CampaignHotelListing({
|
||||
<CampaignHotelListingClient
|
||||
heading={heading}
|
||||
preamble={preamble}
|
||||
bookingCode={bookingCode}
|
||||
visibleCountMobile={visibleCountMobile}
|
||||
visibleCountDesktop={visibleCountDesktop}
|
||||
isMainBlock={isMainBlock}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Suspense } from "react"
|
||||
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
|
||||
import CardsGrid from "@/components/Blocks/CardsGrid"
|
||||
import CarouselCards from "@/components/Blocks/CarouselCards"
|
||||
|
||||
Reference in New Issue
Block a user