signal-desktop/ts/components/Alert.tsx

33 lines
829 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
2021-03-11 21:29:31 +00:00
import React, { FunctionComponent, ReactNode } from 'react';
2021-03-03 20:09:58 +00:00
import { LocalizerType } from '../types/Util';
import { Button } from './Button';
import { ModalHost } from './ModalHost';
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,
}) => (
<ModalHost onClose={onClose}>
<div className="module-Alert">
{title && <h1 className="module-Alert__title">{title}</h1>}
<p className="module-Alert__body">{body}</p>
<div className="module-Alert__button-container">
<Button onClick={onClose}>{i18n('Confirmation--confirm')}</Button>
</div>
</div>
</ModalHost>
);