signal-desktop/ts/components/GlobalModalContainer.tsx

33 lines
737 B
TypeScript
Raw Normal View History

2021-05-28 16:15:17 +00:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2021-09-21 22:37:10 +00:00
import { ContactModalStateType } from '../state/ducks/globalModals';
2021-05-28 16:15:17 +00:00
type PropsType = {
2021-09-21 22:37:10 +00:00
// ContactModal
contactModalState?: ContactModalStateType;
renderContactModal: () => JSX.Element;
2021-07-19 19:26:06 +00:00
// ProfileEditor
isProfileEditorVisible: boolean;
renderProfileEditor: () => JSX.Element;
2021-05-28 16:15:17 +00:00
};
export const GlobalModalContainer = ({
2021-09-21 22:37:10 +00:00
// ContactModal
contactModalState,
renderContactModal,
2021-07-19 19:26:06 +00:00
// ProfileEditor
isProfileEditorVisible,
renderProfileEditor,
2021-05-28 16:15:17 +00:00
}: PropsType): JSX.Element | null => {
2021-09-21 22:37:10 +00:00
if (contactModalState) {
return renderContactModal();
}
2021-07-19 19:26:06 +00:00
if (isProfileEditorVisible) {
return renderProfileEditor();
}
2021-05-28 16:15:17 +00:00
return null;
};