feat(SW-344): Fixed button in card

This commit is contained in:
Pontus Dreij
2024-11-12 15:26:57 +01:00
parent 32429d0a57
commit 3d235b3176
4 changed files with 21 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
import { useParams } from "next/dist/client/components/navigation" import { useParams } from "next/dist/client/components/navigation"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { Lang } from "@/constants/languages"
import { selectHotelMap } from "@/constants/routes/hotelReservation" import { selectHotelMap } from "@/constants/routes/hotelReservation"
import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data" import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data"
@@ -30,6 +31,7 @@ export default function HotelCard({
onHotelCardHover, onHotelCardHover,
}: HotelCardProps) { }: HotelCardProps) {
const params = useParams() const params = useParams()
const lang = params.lang as Lang
const intl = useIntl() const intl = useIntl()
const { hotelData } = hotel const { hotelData } = hotel
@@ -86,7 +88,7 @@ export default function HotelCard({
</Footnote> </Footnote>
<Link <Link
className={styles.addressMobile} className={styles.addressMobile}
href={`${selectHotelMap[params.lang as keyof typeof selectHotelMap]}?selectedHotel=${hotelData.name}`} href={`${selectHotelMap[lang]}?selectedHotel=${hotelData.name}`}
keepSearchParams keepSearchParams
variant="underscored" variant="underscored"
> >

View File

@@ -1,13 +1,18 @@
"use client" "use client"
import { useParams } from "next/navigation"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { Lang } from "@/constants/languages"
import { selectRate } from "@/constants/routes/hotelReservation"
import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data" import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data"
import { CloseLargeIcon } from "@/components/Icons" import { CloseLargeIcon } from "@/components/Icons"
import TripAdvisorIcon from "@/components/Icons/TripAdvisor" import TripAdvisorIcon from "@/components/Icons/TripAdvisor"
import Image from "@/components/Image" import Image from "@/components/Image"
import Button from "@/components/TempDesignSystem/Button" import Button from "@/components/TempDesignSystem/Button"
import Chip from "@/components/TempDesignSystem/Chip" import Chip from "@/components/TempDesignSystem/Chip"
import Link from "@/components/TempDesignSystem/Link"
import Body from "@/components/TempDesignSystem/Text/Body" import Body from "@/components/TempDesignSystem/Text/Body"
import Caption from "@/components/TempDesignSystem/Text/Caption" import Caption from "@/components/TempDesignSystem/Text/Caption"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
@@ -21,6 +26,8 @@ export default function HotelCardDialog({
isOpen, isOpen,
handleClose, handleClose,
}: HotelCardDialogProps) { }: HotelCardDialogProps) {
const params = useParams()
const lang = params.lang as Lang
const intl = useIntl() const intl = useIntl()
if (!data) { if (!data) {
@@ -94,8 +101,15 @@ export default function HotelCardDialog({
</Subtitle> </Subtitle>
)} )}
</div> </div>
<Button size="small" theme="base" className={styles.button}>
<Button asChild theme="base" size="small" className={styles.button}>
<Link
href={`${selectRate[lang]}?hotel=${data.operaId}`}
color="none"
keepSearchParams
>
{intl.formatMessage({ id: "See rooms" })} {intl.formatMessage({ id: "See rooms" })}
</Link>
</Button> </Button>
</div> </div>
</div> </div>

View File

@@ -17,5 +17,6 @@ export function getHotelPins(hotels: HotelData[]): HotelPin[] {
], ],
amenities: hotel.hotelData.detailedFacilities.slice(0, 3), amenities: hotel.hotelData.detailedFacilities.slice(0, 3),
ratings: hotel.hotelData.ratings?.tripAdvisor.rating ?? null, ratings: hotel.hotelData.ratings?.tripAdvisor.rating ?? null,
operaId: hotel.hotelData.operaId,
})) }))
} }

View File

@@ -38,6 +38,7 @@ export type HotelPin = {
}[] }[]
amenities: Filter[] amenities: Filter[]
ratings: number | null ratings: number | null
operaId: string
} }
export interface HotelListingMapContentProps { export interface HotelListingMapContentProps {