From ea3b86c33eeeac4bec871cebb49b098e357ea704 Mon Sep 17 00:00:00 2001 From: Bianca Widstam Date: Tue, 22 Oct 2024 06:18:40 +0000 Subject: [PATCH] feat/SW-451-ui-hotel-card (pull request #700) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feat/SW-451 ui hotel card * feat(SW-451): initial design * feat(SW-451): add gallery icon and responsive design for mobile * feat(SW-451): refactor name, add routing to sidepeek * feat(SW-451): add updated design * feat(SW-451): add tripadvisor chip * feat(SW-451): fix gallery icon * feat(SW-451): fix additional falsy value check * feat(SW-451): fix import type * feat(SW-451): remove galleryIcon until image data exists * feat(SW-451): fix css styling * feat(SW-451): add new design for mobile * feat(SW-451): add translation * feat(SW-451): change css to mobile first * feat(SW-451): change div to article Approved-by: Matilda Landström --- .../hotelreservation/select-rate/page.tsx | 4 +- .../HotelReservation/HotelCard/index.tsx | 6 +- .../HotelReservation/ReadMore/index.tsx | 9 +- .../HotelInfoCard/hotelInfoCard.module.css | 116 ++++++++++++++++++ .../SelectRate/HotelInfoCard/index.tsx | 97 +++++++++++++++ .../selectHotel/selectHotel.ts | 1 + .../selectRate/hotelInfoCardProps.ts | 5 + 7 files changed, 231 insertions(+), 7 deletions(-) create mode 100644 components/HotelReservation/SelectRate/HotelInfoCard/hotelInfoCard.module.css create mode 100644 components/HotelReservation/SelectRate/HotelInfoCard/index.tsx create mode 100644 types/components/hotelReservation/selectRate/hotelInfoCardProps.ts diff --git a/app/[lang]/(live)/(public)/hotelreservation/select-rate/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/select-rate/page.tsx index a9103d2c4..532228434 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/select-rate/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/select-rate/page.tsx @@ -1,6 +1,7 @@ import { getProfileSafely } from "@/lib/trpc/memoizedRequests" import { serverClient } from "@/lib/trpc/server" +import HotelInfoCard from "@/components/HotelReservation/SelectRate/HotelInfoCard" import RoomSelection from "@/components/HotelReservation/SelectRate/RoomSelection" import getHotelReservationQueryParams from "@/components/HotelReservation/SelectRate/RoomSelection/utils" import { setLang } from "@/i18n/serverContext" @@ -50,9 +51,8 @@ export default async function SelectRatePage({ return (
+
- {/* TODO: Add Hotel Listing Card */} -
Hotel Listing Card TBI
- +
diff --git a/components/HotelReservation/ReadMore/index.tsx b/components/HotelReservation/ReadMore/index.tsx index 5814eae54..c8d39fcbe 100644 --- a/components/HotelReservation/ReadMore/index.tsx +++ b/components/HotelReservation/ReadMore/index.tsx @@ -34,7 +34,7 @@ function getAmenitiesList(hotel: Hotel) { return [...detailedAmenities, ...simpleAmenities] } -export default function ReadMore({ hotel, hotelId }: ReadMoreProps) { +export default function ReadMore({ label, hotel, hotelId }: ReadMoreProps) { const intl = useIntl() const [sidePeekOpen, setSidePeekOpen] = useState(false) @@ -46,11 +46,12 @@ export default function ReadMore({ hotel, hotelId }: ReadMoreProps) { onPress={() => { setSidePeekOpen(true) }} - intent={"text"} - color="burgundy" + intent="text" + theme="base" + wrapping className={styles.detailsButton} > - {intl.formatMessage({ id: "See hotel details" })} + {label} b.sortOrder - a.sortOrder) + .slice(0, 5) + + return ( +
+ {hotelAttributes && ( +
+
+ {hotelAttributes.hotelContent.images.metaData.altText} + {hotelAttributes.ratings?.tripAdvisor && ( +
+ + + {hotelAttributes.ratings.tripAdvisor.rating} + +
+ )} + {/* TODO: gallery icon and image carousel */} +
+
+
+ + {hotelAttributes.name} + + + {`${hotelAttributes.address.streetAddress}, ${hotelAttributes.address.city} ∙ ${hotelAttributes.location.distanceToCentre} ${intl.formatMessage({ id: "km to city center" })}`} + + + {hotelAttributes.hotelContent.texts.descriptions.medium} + +
+ +
+
+ + {intl.formatMessage({ id: "At the hotel" })} + + {sortedFacilities?.map((facility) => { + const IconComponent = mapFacilityToIcon(facility.name) + return ( +
+ {IconComponent && ( + + )} + + {facility.name} + +
+ ) + })} +
+ +
+
+
+ )} +
+ ) +} diff --git a/types/components/hotelReservation/selectHotel/selectHotel.ts b/types/components/hotelReservation/selectHotel/selectHotel.ts index 6d1cecfca..b43779714 100644 --- a/types/components/hotelReservation/selectHotel/selectHotel.ts +++ b/types/components/hotelReservation/selectHotel/selectHotel.ts @@ -12,6 +12,7 @@ export interface DetailedAmenity { } export interface ReadMoreProps { + label: string hotelId: string hotel: Hotel } diff --git a/types/components/hotelReservation/selectRate/hotelInfoCardProps.ts b/types/components/hotelReservation/selectRate/hotelInfoCardProps.ts new file mode 100644 index 000000000..0a3526167 --- /dev/null +++ b/types/components/hotelReservation/selectRate/hotelInfoCardProps.ts @@ -0,0 +1,5 @@ +import type { HotelData } from "@/types/hotel" + +export type HotelInfoCardProps = { + hotelData: HotelData | null +}