signal-desktop/ts/components/Alert.tsx

31 lines
698 B
TypeScript
Raw Normal View History

2021-03-03 20:09:58 +00:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { FunctionComponent, ReactNode } from 'react';
import React from 'react';
2021-03-03 20:09:58 +00:00
import type { LocalizerType } from '../types/Util';
2021-03-03 20:09:58 +00:00
import { Button } from './Button';
import { Modal } from './Modal';
2021-03-03 20:09:58 +00:00
type PropsType = {
title?: string;
2021-03-11 21:29:31 +00:00
body: ReactNode;
2021-03-03 20:09:58 +00:00
i18n: LocalizerType;
onClose: () => void;
};
export const Alert: FunctionComponent<PropsType> = ({
body,
i18n,
onClose,
title,
}) => (
<Modal i18n={i18n} onClose={onClose} title={title}>
{body}
<Modal.ButtonFooter>
<Button onClick={onClose}>{i18n('Confirmation--confirm')}</Button>
</Modal.ButtonFooter>
</Modal>
2021-03-03 20:09:58 +00:00
);