// Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React, { ReactChild, ReactNode } from 'react'; import { LocalizerType } from '../types/Util'; import { ConversationType } from '../state/ducks/conversations'; import { ModalHost } from './ModalHost'; import { Button, ButtonVariant } from './Button'; import { Avatar, AvatarSize } from './Avatar'; import { ContactName } from './conversation/ContactName'; type PropsType = { children: ReactNode; i18n: LocalizerType; onClickPrimaryButton: () => void; onClose: () => void; primaryButtonText: string; title: string; } & ( | // We use this empty type for an "all or nothing" setup. // eslint-disable-next-line @typescript-eslint/ban-types {} | { onClickSecondaryButton: () => void; secondaryButtonText: string; } ); export function GroupDialog(props: Readonly): JSX.Element { const { children, i18n, onClickPrimaryButton, onClose, primaryButtonText, title, } = props; let secondaryButton: undefined | ReactChild; if ('secondaryButtonText' in props) { const { onClickSecondaryButton, secondaryButtonText } = props; secondaryButton = ( ); } return (
); } type ParagraphPropsType = { children: ReactNode; }; GroupDialog.Paragraph = ({ children, }: Readonly): JSX.Element => (

{children}

); type ContactsPropsType = { contacts: Array; i18n: LocalizerType; }; GroupDialog.Contacts = ({ contacts, i18n }: Readonly) => (
    {contacts.map(contact => (
  • ))}
); function focusRef(el: HTMLElement | null) { if (el) { el.focus(); } }