fix(SW-995): Made the room cards to have the same height as its neighbors
Approved-by: Matilda Landström
This commit is contained in:
@@ -66,8 +66,10 @@ export function RoomCard({ room }: RoomCardProps) {
|
||||
<ButtonLink
|
||||
href={`?s=room-${getRoomNameAsParam(name)}`}
|
||||
variant="Text"
|
||||
size="Medium"
|
||||
typography="Body/Paragraph/mdBold"
|
||||
scroll={false}
|
||||
className={styles.buttonLink}
|
||||
>
|
||||
{intl.formatMessage({
|
||||
defaultMessage: "See room details",
|
||||
|
||||
@@ -3,20 +3,21 @@
|
||||
background-color: var(--Surface-Primary-Default);
|
||||
border: 1px solid var(--Border-Default);
|
||||
display: grid;
|
||||
grid-template-rows: auto 1fr;
|
||||
overflow: hidden;
|
||||
color: var(--Text-Default);
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: grid;
|
||||
justify-items: center;
|
||||
gap: var(--Space-x05);
|
||||
padding: var(--Space-x2);
|
||||
}
|
||||
|
||||
.innerContent {
|
||||
display: grid;
|
||||
justify-items: center;
|
||||
text-align: center;
|
||||
gap: var(--Space-x1);
|
||||
}
|
||||
|
||||
@@ -28,3 +29,7 @@
|
||||
.roomSize {
|
||||
color: var(--Text-Tertiary);
|
||||
}
|
||||
|
||||
.buttonLink {
|
||||
align-self: end;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
"use client"
|
||||
|
||||
import { useRef, useState } from "react"
|
||||
import { cx } from "class-variance-authority"
|
||||
import { useMemo, useRef, useState } from "react"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import SectionContainer from "@/components/Section/Container"
|
||||
import Grids from "@/components/TempDesignSystem/Grids"
|
||||
import ShowMoreButton from "@/components/TempDesignSystem/ShowMoreButton"
|
||||
|
||||
import { RoomCard } from "./RoomCard"
|
||||
@@ -20,6 +20,9 @@ export function Rooms({ rooms, preamble }: RoomsProps) {
|
||||
const intl = useIntl()
|
||||
const showToggleButton = rooms.length > 3
|
||||
const [allRoomsVisible, setAllRoomsVisible] = useState(!showToggleButton)
|
||||
const sortedRooms = useMemo(() => {
|
||||
return rooms.sort((a, b) => a.sortOrder - b.sortOrder)
|
||||
}, [rooms])
|
||||
|
||||
const scrollRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
@@ -50,17 +53,17 @@ export function Rooms({ rooms, preamble }: RoomsProps) {
|
||||
</Typography>
|
||||
)}
|
||||
</header>
|
||||
<Grids.Stackable
|
||||
className={`${styles.grid} ${allRoomsVisible ? styles.allVisible : ""}`}
|
||||
<ul
|
||||
className={cx(styles.roomsList, {
|
||||
[styles.allVisible]: allRoomsVisible,
|
||||
})}
|
||||
>
|
||||
{rooms
|
||||
.sort((a, b) => a.sortOrder - b.sortOrder)
|
||||
.map((room) => (
|
||||
<div key={room.id}>
|
||||
<RoomCard room={room} />
|
||||
</div>
|
||||
))}
|
||||
</Grids.Stackable>
|
||||
{sortedRooms.map((room) => (
|
||||
<li className={styles.roomsItem} key={room.id}>
|
||||
<RoomCard room={room} />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{showToggleButton ? (
|
||||
<ShowMoreButton
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
.roomsContainer {
|
||||
position: relative;
|
||||
scroll-margin-top: var(--hotel-page-scroll-margin-top);
|
||||
color: var(--Text-Default);
|
||||
}
|
||||
|
||||
.sectionHeader {
|
||||
display: grid;
|
||||
gap: var(--Space-x15);
|
||||
max-width: var(--hotel-page-intro-section-width);
|
||||
}
|
||||
|
||||
.heading {
|
||||
color: var(--Text-Heading);
|
||||
}
|
||||
|
||||
.scrollRef {
|
||||
@@ -8,25 +19,25 @@
|
||||
top: calc(-1 * var(--hotel-page-scroll-margin-top));
|
||||
}
|
||||
|
||||
.ctaContainer {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.showMoreButton.showLess .chevron {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.grid:not(.allVisible) > :nth-child(n + 4) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sectionHeader {
|
||||
.roomsList {
|
||||
display: grid;
|
||||
gap: var(--Spacing-x-one-and-half);
|
||||
max-width: var(--hotel-page-intro-section-width);
|
||||
gap: var(--Space-x2);
|
||||
grid-template-columns: 1fr;
|
||||
list-style: none;
|
||||
|
||||
&:not(.allVisible) > :nth-child(n + 4) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.heading {
|
||||
color: var(--Text-Heading);
|
||||
@media screen and (min-width: 768px) {
|
||||
.roomsList {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1367px) {
|
||||
.roomsList {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,10 @@ export default function RoomFacilities({
|
||||
})}
|
||||
>
|
||||
{mappedFacilities.map((facility) => (
|
||||
<li className={styles.item} key={facility.name}>
|
||||
<li
|
||||
className={styles.item}
|
||||
key={`${facility.name}_${facility.sortOrder}`}
|
||||
>
|
||||
<FacilityIcon
|
||||
name={facility.icon}
|
||||
size={24}
|
||||
|
||||
Reference in New Issue
Block a user