Files
web/apps/scandic-web/components/TempDesignSystem/Popover/index.tsx
Matilda Landström 5de2a993a7 Merged in feat/SW-1711-switch-icons (pull request #1558)
Switches out all the old icons to new ones, and moves them to the design system. The new icons are of three different types: Materialise Symbol, Nucleo, and Customized. Also adds further mapping between facilities/amenities and icons.

Approved-by: Michael Zetterberg
Approved-by: Erik Tiekstra
2025-03-27 09:42:52 +00:00

53 lines
1.2 KiB
TypeScript

import {
Button,
Dialog,
DialogTrigger,
OverlayArrow,
Popover as RAPopover,
} from "react-aria-components"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons"
import useSetOverFlowVisibleOnRA from "@/hooks/useSetOverflowVisibleOnRA"
import { Arrow } from "./Arrow"
import styles from "./popover.module.css"
import type { PopoverProps } from "./popover"
export default function Popover({
triggerContent,
children,
...props
}: PopoverProps) {
const setOverflowVisible = useSetOverFlowVisibleOnRA()
return (
<DialogTrigger onOpenChange={setOverflowVisible}>
<Button className={styles.trigger}>{triggerContent}</Button>
<RAPopover
{...props}
offset={16}
crossOffset={-24}
className={styles.root}
>
<OverlayArrow>
<Arrow />
</OverlayArrow>
<Dialog>
{({ close }) => (
<>
<Button className={styles.closeButton} onPress={close}>
<MaterialIcon icon="close" size={20} />
</Button>
{children}
</>
)}
</Dialog>
</RAPopover>
</DialogTrigger>
)
}