From 8e94c92c7077c113d3870fab2c42c9e3f99fce0c Mon Sep 17 00:00:00 2001 From: Niclas Edenvin Date: Wed, 10 Jul 2024 10:51:15 +0200 Subject: [PATCH] feat(SW-72): move the room selection to its own component --- .../select-rate/page.module.css | 24 ---------- .../hotelreservation/select-rate/page.tsx | 34 +------------- .../{ => RoomSelection}/RoomCard/index.tsx | 0 .../RoomCard/roomCard.module.css | 0 .../SelectRate/RoomSelection/index.tsx | 45 +++++++++++++++++++ .../RoomSelection/roomSelection.module.css | 23 ++++++++++ .../selectRate/roomSelection.ts | 5 +++ 7 files changed, 75 insertions(+), 56 deletions(-) rename components/HotelReservation/SelectRate/{ => RoomSelection}/RoomCard/index.tsx (100%) rename components/HotelReservation/SelectRate/{ => RoomSelection}/RoomCard/roomCard.module.css (100%) create mode 100644 components/HotelReservation/SelectRate/RoomSelection/index.tsx create mode 100644 components/HotelReservation/SelectRate/RoomSelection/roomSelection.module.css create mode 100644 types/components/hotelReservation/selectRate/roomSelection.ts diff --git a/app/[lang]/(live)/(public)/hotelreservation/select-rate/page.module.css b/app/[lang]/(live)/(public)/hotelreservation/select-rate/page.module.css index e7f7cf928..d6c36de71 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/select-rate/page.module.css +++ b/app/[lang]/(live)/(public)/hotelreservation/select-rate/page.module.css @@ -1,8 +1,3 @@ -.header { - margin-top: var(--Spacing-x2); - margin-bottom: var(--Spacing-x2); -} - .hotelInfo { margin-bottom: 64px; } @@ -20,22 +15,3 @@ margin-left: auto; margin-right: auto; } - -.page input[type="radio"] { - opacity: 0; - position: fixed; - width: 0; -} - -.roomList { - margin-top: var(--Spacing-x4); - list-style: none; - display: grid; - grid-template-columns: 1fr 1fr 1fr; - column-gap: var(--Spacing-x2); - row-gap: var(--Spacing-x4); -} - -.roomList > li { - width: 100%; -} diff --git a/app/[lang]/(live)/(public)/hotelreservation/select-rate/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/select-rate/page.tsx index 353ab430b..fd6fed22c 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/select-rate/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/select-rate/page.tsx @@ -1,13 +1,10 @@ import { serverClient } from "@/lib/trpc/server" -import RoomCard from "@/components/HotelReservation/SelectRate/RoomCard" -import Header from "@/components/Section/Header" -import { getIntl } from "@/i18n" +import RoomSelection from "@/components/HotelReservation/SelectRate/RoomSelection" import styles from "./page.module.css" export default async function SelectRate() { - const { formatMessage } = await getIntl() const rooms = await serverClient().hotel.getRates({ // TODO: pass the correct hotel ID and all other parameters that should be included in the search hotelId: "1", @@ -17,34 +14,7 @@ export default async function SelectRate() {
Hotel info TBI
-
-
-
- -
    - {rooms.map((room) => ( -
  • - - -
  • - ))} -
+
) diff --git a/components/HotelReservation/SelectRate/RoomCard/index.tsx b/components/HotelReservation/SelectRate/RoomSelection/RoomCard/index.tsx similarity index 100% rename from components/HotelReservation/SelectRate/RoomCard/index.tsx rename to components/HotelReservation/SelectRate/RoomSelection/RoomCard/index.tsx diff --git a/components/HotelReservation/SelectRate/RoomCard/roomCard.module.css b/components/HotelReservation/SelectRate/RoomSelection/RoomCard/roomCard.module.css similarity index 100% rename from components/HotelReservation/SelectRate/RoomCard/roomCard.module.css rename to components/HotelReservation/SelectRate/RoomSelection/RoomCard/roomCard.module.css diff --git a/components/HotelReservation/SelectRate/RoomSelection/index.tsx b/components/HotelReservation/SelectRate/RoomSelection/index.tsx new file mode 100644 index 000000000..1b802581f --- /dev/null +++ b/components/HotelReservation/SelectRate/RoomSelection/index.tsx @@ -0,0 +1,45 @@ +import Header from "@/components/Section/Header" +import { getIntl } from "@/i18n" + +import RoomCard from "./RoomCard" + +import styles from "./roomSelection.module.css" + +import { RoomSelectionProps } from "@/types/components/hotelReservation/selectRate/roomSelection" + +export default async function RoomSelection({ rooms }: RoomSelectionProps) { + const { formatMessage } = await getIntl() + + return ( +
+
+
+
+ + +
+ ) +} diff --git a/components/HotelReservation/SelectRate/RoomSelection/roomSelection.module.css b/components/HotelReservation/SelectRate/RoomSelection/roomSelection.module.css new file mode 100644 index 000000000..a559b3f52 --- /dev/null +++ b/components/HotelReservation/SelectRate/RoomSelection/roomSelection.module.css @@ -0,0 +1,23 @@ +.header { + margin-top: var(--Spacing-x2); + margin-bottom: var(--Spacing-x2); +} + +.roomList { + margin-top: var(--Spacing-x4); + list-style: none; + display: grid; + grid-template-columns: 1fr 1fr 1fr; + column-gap: var(--Spacing-x2); + row-gap: var(--Spacing-x4); +} + +.roomList > li { + width: 100%; +} + +.roomList input[type="radio"] { + opacity: 0; + position: fixed; + width: 0; +} diff --git a/types/components/hotelReservation/selectRate/roomSelection.ts b/types/components/hotelReservation/selectRate/roomSelection.ts new file mode 100644 index 000000000..be21abaed --- /dev/null +++ b/types/components/hotelReservation/selectRate/roomSelection.ts @@ -0,0 +1,5 @@ +import { Rate } from "@/server/routers/hotels/output" + +export type RoomSelectionProps = { + rooms: Rate[] +}