From 50611d1be277e8504534101bb2247c3506ad325c Mon Sep 17 00:00:00 2001 From: Fredrik Thorsson Date: Tue, 3 Dec 2024 15:33:37 +0100 Subject: [PATCH] feat(SW-644): add book parking button --- .../Parking/ParkingPrices/index.tsx | 4 +- .../AccordionAmenities/Parking/index.tsx | 37 +++++++++++++++++-- .../Parking/parkingAmenity.module.css | 8 +++- components/Icons/ExternalLink.tsx | 27 ++++++++++++++ components/Icons/get-icon-by-icon-name.ts | 3 ++ components/Icons/index.tsx | 1 + i18n/dictionaries/da.json | 2 + i18n/dictionaries/de.json | 2 + i18n/dictionaries/en.json | 2 + i18n/dictionaries/fi.json | 2 + i18n/dictionaries/no.json | 2 + i18n/dictionaries/sv.json | 2 + server/routers/hotels/output.ts | 1 + .../components/hotelPage/sidepeek/parking.ts | 3 +- types/components/icon.ts | 1 + 15 files changed, 89 insertions(+), 8 deletions(-) create mode 100644 components/Icons/ExternalLink.tsx diff --git a/components/ContentType/HotelPage/SidePeeks/Amenities/AccordionAmenities/Parking/ParkingPrices/index.tsx b/components/ContentType/HotelPage/SidePeeks/Amenities/AccordionAmenities/Parking/ParkingPrices/index.tsx index b524c9896..3ca2bb527 100644 --- a/components/ContentType/HotelPage/SidePeeks/Amenities/AccordionAmenities/Parking/ParkingPrices/index.tsx +++ b/components/ContentType/HotelPage/SidePeeks/Amenities/AccordionAmenities/Parking/ParkingPrices/index.tsx @@ -9,7 +9,7 @@ import { } from "@/types/components/hotelPage/sidepeek/parking" export default async function ParkingPrices({ - data, + pricing, currency, freeParking, }: ParkingPricesProps) { @@ -31,7 +31,7 @@ export default async function ParkingPrices({ } } - const filteredPeriods = data?.filter((filter) => filter.period !== "Hour") + const filteredPeriods = pricing?.filter((filter) => filter.period !== "Hour") return (
diff --git a/components/ContentType/HotelPage/SidePeeks/Amenities/AccordionAmenities/Parking/index.tsx b/components/ContentType/HotelPage/SidePeeks/Amenities/AccordionAmenities/Parking/index.tsx index d706f03a8..47cb6afda 100644 --- a/components/ContentType/HotelPage/SidePeeks/Amenities/AccordionAmenities/Parking/index.tsx +++ b/components/ContentType/HotelPage/SidePeeks/Amenities/AccordionAmenities/Parking/index.tsx @@ -1,5 +1,8 @@ +import { ExternalLinkIcon } from "@/components/Icons" import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem" +import Button from "@/components/TempDesignSystem/Button" import Divider from "@/components/TempDesignSystem/Divider" +import Link from "@/components/TempDesignSystem/Link" import Body from "@/components/TempDesignSystem/Text/Body" import Caption from "@/components/TempDesignSystem/Text/Caption" import { getIntl } from "@/i18n" @@ -12,7 +15,10 @@ import styles from "./parkingAmenity.module.css" import type { ParkingAmenityProps } from "@/types/components/hotelPage/sidepeek/parking" import { IconName } from "@/types/components/icon" -export default async function ParkingAmenity({ parking }: ParkingAmenityProps) { +export default async function ParkingAmenity({ + parking, + contentPageLink, +}: ParkingAmenityProps) { const intl = await getIntl() return ( @@ -43,7 +49,7 @@ export default async function ParkingAmenity({ parking }: ParkingAmenityProps) { @@ -54,15 +60,40 @@ export default async function ParkingAmenity({ parking }: ParkingAmenityProps) {
+ {data.externalParkingUrl && ( + + )} ))} + {contentPageLink && ( + + )} ) } diff --git a/components/ContentType/HotelPage/SidePeeks/Amenities/AccordionAmenities/Parking/parkingAmenity.module.css b/components/ContentType/HotelPage/SidePeeks/Amenities/AccordionAmenities/Parking/parkingAmenity.module.css index 7535e3543..6bec9b687 100644 --- a/components/ContentType/HotelPage/SidePeeks/Amenities/AccordionAmenities/Parking/parkingAmenity.module.css +++ b/components/ContentType/HotelPage/SidePeeks/Amenities/AccordionAmenities/Parking/parkingAmenity.module.css @@ -1,9 +1,9 @@ -.wrapper { +.wrapper, +.information { display: grid; gap: var(--Spacing-x3); } -.information, .list, .prices { display: grid; @@ -18,3 +18,7 @@ display: grid; gap: var(--Spacing-x1); } + +.contentPageLink { + margin-top: var(--Spacing-x2); +} diff --git a/components/Icons/ExternalLink.tsx b/components/Icons/ExternalLink.tsx new file mode 100644 index 000000000..b58260209 --- /dev/null +++ b/components/Icons/ExternalLink.tsx @@ -0,0 +1,27 @@ +import { iconVariants } from "./variants" + +import type { IconProps } from "@/types/components/icon" + +export default function ExternalLinkIcon({ + className, + color, + ...props +}: IconProps) { + const classNames = iconVariants({ className, color }) + return ( + + + + ) +} diff --git a/components/Icons/get-icon-by-icon-name.ts b/components/Icons/get-icon-by-icon-name.ts index 7ba60f321..ed24e0377 100644 --- a/components/Icons/get-icon-by-icon-name.ts +++ b/components/Icons/get-icon-by-icon-name.ts @@ -36,6 +36,7 @@ import { ElectricBikeIcon, ElectricCarIcon, EmailIcon, + ExternalLinkIcon, EyeHideIcon, EyeShowIcon, FacebookIcon, @@ -176,6 +177,8 @@ export function getIconByIconName( return ElectricCarIcon case IconName.Email: return EmailIcon + case IconName.ExternalLink: + return ExternalLinkIcon case IconName.EyeHide: return EyeHideIcon case IconName.EyeShow: diff --git a/components/Icons/index.tsx b/components/Icons/index.tsx index f56e5128f..580e941cd 100644 --- a/components/Icons/index.tsx +++ b/components/Icons/index.tsx @@ -61,6 +61,7 @@ export { default as ElectricBikeIcon } from "./ElectricBike" export { default as ElectricCarIcon } from "./ElectricCar" export { default as EmailIcon } from "./Email" export { default as ErrorCircleIcon } from "./ErrorCircle" +export { default as ExternalLinkIcon } from "./ExternalLink" export { default as EyeHideIcon } from "./EyeHide" export { default as EyeShowIcon } from "./EyeShow" export { default as FacebookIcon } from "./Facebook" diff --git a/i18n/dictionaries/da.json b/i18n/dictionaries/da.json index 9b25a0cf0..eefc1cd1d 100644 --- a/i18n/dictionaries/da.json +++ b/i18n/dictionaries/da.json @@ -8,6 +8,7 @@ "ALLG": "Allergi", "About accessibility": "Om tilgængelighed", "About meetings & conferences": "About meetings & conferences", + "About parking": "Om parkering", "About the hotel": "Om hotellet", "Accept new price": "Accepter ny pris", "Accessibility": "Tilgængelighed", @@ -47,6 +48,7 @@ "Bed type": "Seng type", "Birth date": "Fødselsdato", "Book": "Book", + "Book parking": "Book parkering", "Book reward night": "Book bonusnat", "Booking number": "Bookingnummer", "Breakfast": "Morgenmad", diff --git a/i18n/dictionaries/de.json b/i18n/dictionaries/de.json index 260a74ec3..8c5352c9b 100644 --- a/i18n/dictionaries/de.json +++ b/i18n/dictionaries/de.json @@ -8,6 +8,7 @@ "ALLG": "Allergie", "About accessibility": "Über Barrierefreiheit", "About meetings & conferences": "About meetings & conferences", + "About parking": "Über das Parken", "About the hotel": "Über das Hotel", "Accept new price": "Neuen Preis akzeptieren", "Accessibility": "Zugänglichkeit", @@ -47,6 +48,7 @@ "Bed type": "Bettentyp", "Birth date": "Geburtsdatum", "Book": "Buchen", + "Book parking": "Parkplatz buchen", "Book reward night": "Bonusnacht buchen", "Booking number": "Buchungsnummer", "Breakfast": "Frühstück", diff --git a/i18n/dictionaries/en.json b/i18n/dictionaries/en.json index e1a898dc5..91c371258 100644 --- a/i18n/dictionaries/en.json +++ b/i18n/dictionaries/en.json @@ -8,6 +8,7 @@ "ALLG": "Allergy", "About accessibility": "About accessibility", "About meetings & conferences": "About meetings & conferences", + "About parking": "About parking", "About the hotel": "About the hotel", "Accept new price": "Accept new price", "Accessibility": "Accessibility", @@ -49,6 +50,7 @@ "Birth date": "Birth date", "Book": "Book", "Book another stay": "Book another stay", + "Book parking": "Book parking", "Book reward night": "Book reward night", "Book your next stay": "Book your next stay", "Booking": "Booking", diff --git a/i18n/dictionaries/fi.json b/i18n/dictionaries/fi.json index 35e197fbc..086e635de 100644 --- a/i18n/dictionaries/fi.json +++ b/i18n/dictionaries/fi.json @@ -8,6 +8,7 @@ "ALLG": "Allergia", "About accessibility": "Tietoja saavutettavuudesta", "About meetings & conferences": "About meetings & conferences", + "About parking": "Tietoja pysäköinnistä", "About the hotel": "Tietoja hotellista", "Accept new price": "Hyväksy uusi hinta", "Accessibility": "Saavutettavuus", @@ -47,6 +48,7 @@ "Bed type": "Vuodetyyppi", "Birth date": "Syntymäaika", "Book": "Varaa", + "Book parking": "Varaa pysäköinti", "Book reward night": "Kirjapalkinto-ilta", "Booking number": "Varausnumero", "Breakfast": "Aamiainen", diff --git a/i18n/dictionaries/no.json b/i18n/dictionaries/no.json index 64c3299cb..6de6aa1e4 100644 --- a/i18n/dictionaries/no.json +++ b/i18n/dictionaries/no.json @@ -8,6 +8,7 @@ "ALLG": "Allergi", "About accessibility": "Om tilgjengelighet", "About meetings & conferences": "About meetings & conferences", + "About parking": "Om parkering", "About the hotel": "Om hotellet", "Accept new price": "Aksepterer ny pris", "Accessibility": "Tilgjengelighet", @@ -47,6 +48,7 @@ "Bed type": "Seng type", "Birth date": "Fødselsdato", "Book": "Bestill", + "Book parking": "Bestill parkering", "Book reward night": "Bestill belønningskveld", "Booking number": "Bestillingsnummer", "Breakfast": "Frokost", diff --git a/i18n/dictionaries/sv.json b/i18n/dictionaries/sv.json index ee471eee7..31ad5c056 100644 --- a/i18n/dictionaries/sv.json +++ b/i18n/dictionaries/sv.json @@ -8,6 +8,7 @@ "ALLG": "Allergi", "About accessibility": "Om tillgänglighet", "About meetings & conferences": "About meetings & conferences", + "About parking": "Om parkering", "About the hotel": "Om hotellet", "Accept new price": "Accepter ny pris", "Accessibility": "Tillgänglighet", @@ -47,6 +48,7 @@ "Bed type": "Sängtyp", "Birth date": "Födelsedatum", "Book": "Boka", + "Book parking": "Boka parkering", "Book reward night": "Boka frinatt", "Booking number": "Bokningsnummer", "Breakfast": "Frukost", diff --git a/server/routers/hotels/output.ts b/server/routers/hotels/output.ts index 76f29349a..0b5cfb726 100644 --- a/server/routers/hotels/output.ts +++ b/server/routers/hotels/output.ts @@ -298,6 +298,7 @@ export const parkingSchema = z.object({ numberOfChargingSpaces: z.number().optional(), distanceToHotel: z.number().optional(), canMakeReservation: z.boolean(), + externalParkingUrl: z.string().optional(), pricing: parkingPricingSchema, }) diff --git a/types/components/hotelPage/sidepeek/parking.ts b/types/components/hotelPage/sidepeek/parking.ts index 67c1653e8..6a424246f 100644 --- a/types/components/hotelPage/sidepeek/parking.ts +++ b/types/components/hotelPage/sidepeek/parking.ts @@ -8,6 +8,7 @@ export enum Periods { export type ParkingAmenityProps = { parking: Hotel["parking"] + contentPageLink?: string } export type ParkingListProps = { @@ -19,7 +20,7 @@ export type ParkingListProps = { } export type ParkingPricesProps = { - data: Hotel["parking"][number]["pricing"]["localCurrency"]["ordinary"] + pricing: Hotel["parking"][number]["pricing"]["localCurrency"]["ordinary"] currency: Hotel["parking"][number]["pricing"]["localCurrency"]["currency"] freeParking: Hotel["parking"][number]["pricing"]["freeParking"] } diff --git a/types/components/icon.ts b/types/components/icon.ts index 3d47bbe9a..b21d12cdd 100644 --- a/types/components/icon.ts +++ b/types/components/icon.ts @@ -42,6 +42,7 @@ export enum IconName { ElectricBike = "ElectricBike", ElectricCar = "ElectricCar", Email = "Email", + ExternalLink = "ExternalLink", EyeHide = "EyeHide", EyeShow = "EyeShow", Facebook = "Facebook",