signal-desktop/ts/components/Alert.tsx

42 lines
807 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
2022-11-18 00:45:19 +00:00
import type { ReactNode } from 'react';
import React from 'react';
2021-03-03 20:09:58 +00:00
import type { LocalizerType } from '../types/Util';
import type { Theme } from '../util/theme';
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 = {
2021-03-11 21:29:31 +00:00
body: ReactNode;
2021-03-03 20:09:58 +00:00
i18n: LocalizerType;
onClose: () => void;
theme?: Theme;
title?: string;
2021-03-03 20:09:58 +00:00
};
2022-11-18 00:45:19 +00:00
export function Alert({
2021-03-03 20:09:58 +00:00
body,
i18n,
onClose,
theme,
2021-03-03 20:09:58 +00:00
title,
2022-11-18 00:45:19 +00:00
}: PropsType): JSX.Element {
return (
<Modal
i18n={i18n}
modalFooter={
<Button onClick={onClose}>{i18n('Confirmation--confirm')}</Button>
}
modalName="Alert"
onClose={onClose}
theme={theme}
title={title}
>
{body}
</Modal>
);
}