feat(SW-826): Added showCTA prop

This commit is contained in:
Pontus Dreij
2024-11-13 20:39:13 +01:00
parent 69ca6211ec
commit 5c85e59bba
7 changed files with 15 additions and 7 deletions

View File

@@ -10,12 +10,12 @@ import styles from "./readMore.module.css"
import { ReadMoreProps } from "@/types/components/hotelReservation/selectHotel/selectHotel"
import { SidePeekEnum } from "@/types/components/hotelReservation/sidePeek"
export default function ReadMore({ label, hotelId }: ReadMoreProps) {
export default function ReadMore({ label, hotelId, showCTA }: ReadMoreProps) {
const openSidePeek = useSidePeekStore((state) => state.openSidePeek)
return (
<Button
onPress={() => {
openSidePeek({ key: SidePeekEnum.hotelDetails, hotelId })
openSidePeek({ key: SidePeekEnum.hotelDetails, hotelId, showCTA })
}}
intent="text"
theme="base"

View File

@@ -81,6 +81,7 @@ export default function HotelInfoCard({ hotelData }: HotelInfoCardProps) {
label={intl.formatMessage({ id: "Show all amenities" })}
hotelId={hotelAttributes.operaId}
hotel={hotelAttributes}
showCTA={false}
/>
</div>
</div>

View File

@@ -17,6 +17,7 @@ export default function HotelReservationSidePeek({
const activeSidePeek = useSidePeekStore((state) => state.activeSidePeek)
const hotelId = useSidePeekStore((state) => state.hotelId)
const roomTypeCode = useSidePeekStore((state) => state.roomTypeCode)
const showCTA = useSidePeekStore((state) => state.showCTA)
const close = useSidePeekStore((state) => state.closeSidePeek)
const lang = useLang()
@@ -43,6 +44,7 @@ export default function HotelReservationSidePeek({
hotel={hotelData.data?.attributes}
activeSidePeek={activeSidePeek}
close={close}
showCTA={showCTA}
/>
)}
{selectedRoom && (

View File

@@ -27,12 +27,11 @@ export default function HotelSidePeek({
hotel,
activeSidePeek,
close,
showCTA = true,
}: HotelSidePeekProps) {
const intl = useIntl()
const amenitiesList = getAmenitiesList(hotel)
const isSelectHotelPage = window.location.href.includes("select-hotel")
return (
<SidePeek
title={hotel.name}
@@ -64,7 +63,7 @@ export default function HotelSidePeek({
)
})}
</Accordion>
{isSelectHotelPage && (
{showCTA && (
/* TODO: handle linking to Hotel Page */
<Button theme={"base"}>To the hotel</Button>
)}

View File

@@ -6,14 +6,17 @@ interface SidePeekState {
activeSidePeek: SidePeekEnum | null
hotelId: string | null
roomTypeCode: string | null
showCTA: boolean
openSidePeek: ({
key,
hotelId,
roomTypeCode,
showCTA,
}: {
key: SidePeekEnum | null
hotelId: string
roomTypeCode?: string
showCTA?: boolean
}) => void
closeSidePeek: () => void
}
@@ -22,8 +25,9 @@ const useSidePeekStore = create<SidePeekState>((set) => ({
activeSidePeek: null,
hotelId: null,
roomTypeCode: null,
openSidePeek: ({ key, hotelId, roomTypeCode }) =>
set({ activeSidePeek: key, hotelId, roomTypeCode }),
showCTA: true,
openSidePeek: ({ key, hotelId, roomTypeCode, showCTA }) =>
set({ activeSidePeek: key, hotelId, roomTypeCode, showCTA }),
closeSidePeek: () =>
set({ activeSidePeek: null, hotelId: null, roomTypeCode: null }),
}))

View File

@@ -5,4 +5,5 @@ export type HotelSidePeekProps = {
hotel: Hotel
activeSidePeek: SidePeekEnum
close: () => void
showCTA?: boolean
}

View File

@@ -9,6 +9,7 @@ export interface ReadMoreProps {
label: string
hotelId: string
hotel: Hotel
showCTA: boolean
}
export interface ContactProps {