// Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React, { useState, ReactElement, ReactNode } from 'react'; import classNames from 'classnames'; import { noop } from 'lodash'; import { LocalizerType } from '../types/Util'; import { ModalHost } from './ModalHost'; import { Theme } from '../util/theme'; type PropsType = { children: ReactNode; hasXButton?: boolean; i18n: LocalizerType; moduleClassName?: string; onClose?: () => void; title?: ReactNode; theme?: Theme; }; export function Modal({ children, hasXButton, i18n, moduleClassName, onClose = noop, title, theme, }: Readonly): ReactElement { const [scrolled, setScrolled] = useState(false); const hasHeader = Boolean(hasXButton || title); return (
{hasHeader && (
{hasXButton && (
)}
{ setScrolled((event.target as HTMLDivElement).scrollTop > 2); }} > {children}
); } Modal.Footer = ({ children, }: Readonly<{ children: ReactNode }>): ReactElement => (
{children}
);