fix (SW-2940): Close ameneties SidePeek when navigating from select-rate * fix (SW-2940): Close ameneties SidePeek when navigating from select-rate Approved-by: Tobias Johansson
41 lines
981 B
TypeScript
41 lines
981 B
TypeScript
"use client"
|
|
import { useEffect } from "react"
|
|
|
|
import { Button } from "@scandic-hotels/design-system/Button"
|
|
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
|
|
|
import useSidePeekStore from "@/stores/sidepeek"
|
|
|
|
import type { ReadMoreProps } from "@/types/components/hotelReservation/selectHotel/selectHotel"
|
|
|
|
export default function ReadMore({
|
|
label,
|
|
hotelId,
|
|
showCTA,
|
|
sidePeekKey,
|
|
}: ReadMoreProps) {
|
|
const { openSidePeek, closeSidePeek } = useSidePeekStore((state) => ({
|
|
openSidePeek: state.openSidePeek,
|
|
closeSidePeek: state.closeSidePeek,
|
|
}))
|
|
|
|
useEffect(() => {
|
|
return () => {
|
|
closeSidePeek()
|
|
}
|
|
}, [closeSidePeek])
|
|
|
|
return (
|
|
<Button
|
|
onPress={() => {
|
|
openSidePeek({ key: sidePeekKey, hotelId, showCTA })
|
|
}}
|
|
variant="Text"
|
|
typography="Body/Paragraph/mdBold"
|
|
>
|
|
{label}
|
|
<MaterialIcon icon="chevron_right" size={24} color="CurrentColor" />
|
|
</Button>
|
|
)
|
|
}
|