Merged in feat/SW-3289-replace-sidepeek-hotel-reservation (pull request #2686)
feat(SW-3289): replace sidepeek * fix(SW-3289): replace sidepeek * fix(SW-3289): add wrapping prop and change prop name to buttonVariant * fix(SW-3289): replace body with typography * fix(SW-3289): fix intl message Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -9,14 +9,14 @@ import { Button } from "@scandic-hotels/design-system/Button"
|
||||
import Footnote from "@scandic-hotels/design-system/Footnote"
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import Subtitle from "@scandic-hotels/design-system/Subtitle"
|
||||
import { getHotelRoom } from "@scandic-hotels/trpc/routers/booking/helpers"
|
||||
|
||||
import { useEnterDetailsStore } from "@/stores/enter-details"
|
||||
|
||||
import RoomDetailsSidePeek from "@/components/SidePeeks/RoomDetailsSidePeek"
|
||||
import { useRoomContext } from "@/contexts/Details/Room"
|
||||
import useLang from "@/hooks/useLang"
|
||||
|
||||
import ToggleSidePeek from "./ToggleSidePeek"
|
||||
|
||||
import styles from "./selectedRoom.module.css"
|
||||
|
||||
export default function SelectedRoom() {
|
||||
@@ -25,10 +25,13 @@ export default function SelectedRoom() {
|
||||
const router = useRouter()
|
||||
const [isPending, startTransition] = useTransition()
|
||||
const { room, idx } = useRoomContext()
|
||||
const { hotelId, searchParamsStr } = useEnterDetailsStore((state) => ({
|
||||
hotelId: state.booking.hotelId,
|
||||
searchParamsStr: state.searchParamString,
|
||||
}))
|
||||
const { hotelId, roomCategories, searchParamsStr } = useEnterDetailsStore(
|
||||
(state) => ({
|
||||
hotelId: state.booking.hotelId,
|
||||
roomCategories: state.roomCategories,
|
||||
searchParamsStr: state.searchParamString,
|
||||
})
|
||||
)
|
||||
|
||||
function changeRoom() {
|
||||
const searchParams = new URLSearchParams(searchParamsStr)
|
||||
@@ -39,6 +42,8 @@ export default function SelectedRoom() {
|
||||
})
|
||||
}
|
||||
|
||||
const selectedRoom = getHotelRoom(roomCategories, room.roomTypeCode)
|
||||
|
||||
return (
|
||||
<div className={styles.wrapper} data-available={room.isAvailable}>
|
||||
<div className={styles.main}>
|
||||
@@ -79,6 +84,7 @@ export default function SelectedRoom() {
|
||||
size="Small"
|
||||
onPress={changeRoom}
|
||||
isDisabled={isPending}
|
||||
wrapping={false}
|
||||
typography="Body/Supporting text (caption)/smBold"
|
||||
>
|
||||
<MaterialIcon icon="edit_square" size={20} color="CurrentColor" />
|
||||
@@ -87,11 +93,17 @@ export default function SelectedRoom() {
|
||||
})}
|
||||
</Button>
|
||||
</div>
|
||||
{room.roomTypeCode && (
|
||||
{room.roomTypeCode && selectedRoom && (
|
||||
<div className={styles.details}>
|
||||
<ToggleSidePeek
|
||||
<RoomDetailsSidePeek
|
||||
hotelId={hotelId}
|
||||
roomTypeCode={room.roomTypeCode}
|
||||
room={selectedRoom}
|
||||
buttonVariant="primary"
|
||||
triggerLabel={intl.formatMessage({
|
||||
defaultMessage: "See room details",
|
||||
})}
|
||||
wrapping={false}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user