fix(SW-203): only activate scrolling upon hiding rooms
This commit is contained in:
@@ -41,8 +41,9 @@ export function Rooms({ rooms }: RoomsProps) {
|
|||||||
.sort((a, b) => a.sortOrder - b.sortOrder)
|
.sort((a, b) => a.sortOrder - b.sortOrder)
|
||||||
|
|
||||||
function handleToggleShowMore() {
|
function handleToggleShowMore() {
|
||||||
setAllRoomsVisible(!allRoomsVisible)
|
const newState = !allRoomsVisible
|
||||||
if (scrollRef.current) {
|
setAllRoomsVisible(newState)
|
||||||
|
if (scrollRef.current && !newState) {
|
||||||
scrollRef.current.scrollIntoView({ behavior: "smooth" })
|
scrollRef.current.scrollIntoView({ behavior: "smooth" })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,6 +75,7 @@ export function Rooms({ rooms }: RoomsProps) {
|
|||||||
<div className={styles.ctaContainer}>
|
<div className={styles.ctaContainer}>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleToggleShowMore}
|
onClick={handleToggleShowMore}
|
||||||
|
intent="text"
|
||||||
variant="icon"
|
variant="icon"
|
||||||
className={`${styles.showMoreButton} ${allRoomsVisible ? styles.showLess : ""}`}
|
className={`${styles.showMoreButton} ${allRoomsVisible ? styles.showLess : ""}`}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user