signal-desktop/ts/components/GlobalModalContainer.tsx

33 lines
737 B
TypeScript
Raw Normal View History

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