feat: add useSetOverflowVisibleOnRA hook
This commit is contained in:
committed by
Joakim Jäderberg
parent
bb49dccc9e
commit
bdbdfa80ab
@@ -180,7 +180,7 @@ export default function Summary({ showMemberPrice, room }: SummaryProps) {
|
|||||||
{room.cancellationText}
|
{room.cancellationText}
|
||||||
</Caption>
|
</Caption>
|
||||||
<Popover
|
<Popover
|
||||||
placement={"bottom left"}
|
placement="bottom left"
|
||||||
triggerContent={
|
triggerContent={
|
||||||
<Caption color="burgundy" type="underline">
|
<Caption color="burgundy" type="underline">
|
||||||
{intl.formatMessage({ id: "Rate details" })}
|
{intl.formatMessage({ id: "Rate details" })}
|
||||||
@@ -189,7 +189,7 @@ export default function Summary({ showMemberPrice, room }: SummaryProps) {
|
|||||||
>
|
>
|
||||||
<aside className={styles.rateDetailsPopover}>
|
<aside className={styles.rateDetailsPopover}>
|
||||||
<header>
|
<header>
|
||||||
<Caption type={"bold"}>{room.cancellationText}</Caption>
|
<Caption type="bold">{room.cancellationText}</Caption>
|
||||||
</header>
|
</header>
|
||||||
{room.rateDetails?.map((detail, idx) => (
|
{room.rateDetails?.map((detail, idx) => (
|
||||||
<Caption key={`rateDetails-${idx}`}>{detail}</Caption>
|
<Caption key={`rateDetails-${idx}`}>{detail}</Caption>
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
import { Button, Dialog, OverlayArrow, Popover } from "react-aria-components"
|
|
||||||
|
|
||||||
import { CloseIcon } from "@/components/Icons"
|
|
||||||
|
|
||||||
import styles from "./popover.module.css"
|
|
||||||
|
|
||||||
import { PricePopoverProps } from "@/types/components/hotelReservation/selectRate/pricePopover"
|
|
||||||
|
|
||||||
export default function PricePopover({
|
|
||||||
children,
|
|
||||||
...props
|
|
||||||
}: PricePopoverProps) {
|
|
||||||
return (
|
|
||||||
<Popover {...props}>
|
|
||||||
<OverlayArrow className={styles.arrow}>
|
|
||||||
<svg
|
|
||||||
width="12"
|
|
||||||
height="12"
|
|
||||||
viewBox="0 0 12 12"
|
|
||||||
style={{ display: "block", transform: "rotate(180deg)" }}
|
|
||||||
>
|
|
||||||
<path d="M0 0L6 6L12 0" fill="white" />
|
|
||||||
</svg>
|
|
||||||
</OverlayArrow>
|
|
||||||
<Dialog>
|
|
||||||
<Button
|
|
||||||
onPress={() => props.onOpenChange?.(false)}
|
|
||||||
className={styles.closeButton}
|
|
||||||
>
|
|
||||||
<CloseIcon className={styles.closeIcon} />
|
|
||||||
</Button>
|
|
||||||
{children}
|
|
||||||
</Dialog>
|
|
||||||
</Popover>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
.arrow {
|
|
||||||
top: -6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.closeButton {
|
|
||||||
position: absolute;
|
|
||||||
top: 5px;
|
|
||||||
right: 5px;
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useRef } from "react"
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Dialog,
|
Dialog,
|
||||||
@@ -8,6 +7,7 @@ import {
|
|||||||
} from "react-aria-components"
|
} from "react-aria-components"
|
||||||
|
|
||||||
import { CloseLargeIcon } from "@/components/Icons"
|
import { CloseLargeIcon } from "@/components/Icons"
|
||||||
|
import useSetOverFlowVisibleOnRA from "@/hooks/useSetOverflowVisibleOnRA"
|
||||||
|
|
||||||
import { Arrow } from "./Arrow"
|
import { Arrow } from "./Arrow"
|
||||||
import { PopoverProps } from "./popover"
|
import { PopoverProps } from "./popover"
|
||||||
@@ -19,10 +19,10 @@ export default function Popover({
|
|||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
}: PopoverProps) {
|
}: PopoverProps) {
|
||||||
let triggerRef = useRef(null)
|
const setOverflowVisible = useSetOverFlowVisibleOnRA()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DialogTrigger>
|
<DialogTrigger onOpenChange={setOverflowVisible}>
|
||||||
<Button className={styles.trigger}>{triggerContent}</Button>
|
<Button className={styles.trigger}>{triggerContent}</Button>
|
||||||
|
|
||||||
<RAPopover
|
<RAPopover
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
import type { PopoverProps } from "react-aria-components"
|
|
||||||
|
|
||||||
export interface PricePopoverProps extends Omit<PopoverProps, "children"> {
|
|
||||||
children: React.ReactNode
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user