2025-02-19 17:31:33 -08:00
|
|
|
// Copyright 2025 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import type { ReactNode } from 'react';
|
|
|
|
import React from 'react';
|
|
|
|
import type { Placement } from 'react-aria';
|
|
|
|
import { Dialog, Popover } from 'react-aria-components';
|
2025-04-02 11:14:12 -07:00
|
|
|
import classNames from 'classnames';
|
|
|
|
import { ThemeType } from '../../../types/Util';
|
2025-02-19 17:31:33 -08:00
|
|
|
|
|
|
|
export type FunPopoverProps = Readonly<{
|
|
|
|
placement?: Placement;
|
2025-04-02 11:14:12 -07:00
|
|
|
theme?: ThemeType;
|
2025-02-19 17:31:33 -08:00
|
|
|
children: ReactNode;
|
|
|
|
}>;
|
|
|
|
|
|
|
|
export function FunPopover(props: FunPopoverProps): JSX.Element {
|
|
|
|
return (
|
2025-04-02 11:14:12 -07:00
|
|
|
<Popover
|
2025-04-10 14:50:00 -07:00
|
|
|
data-fun-overlay
|
2025-04-02 11:14:12 -07:00
|
|
|
className={classNames('FunPopover', {
|
|
|
|
'light-theme': props.theme === ThemeType.light,
|
|
|
|
'dark-theme': props.theme === ThemeType.dark,
|
|
|
|
})}
|
|
|
|
placement={props.placement}
|
|
|
|
>
|
2025-02-19 17:31:33 -08:00
|
|
|
<Dialog className="FunPopover__Dialog">{props.children}</Dialog>
|
|
|
|
</Popover>
|
|
|
|
);
|
|
|
|
}
|