2 * Copyright © 2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 import React from 'react';
18 import PropTypes from 'prop-types';
26 } from 'onap-ui-react';
28 import modalWrapperComponents from 'shared/modal/modalWrapperComponents';
30 class ModalWrapperView extends React.Component {
34 this.handleClose = this.handleClose.bind(this);
38 const { hideModal, onClose } = this.props;
42 if (typeof onClose === 'function') {
48 const { modal } = this.props;
50 if (!modal || !modal.type) {
67 const CustomComponent =
68 customComponentName && modalWrapperComponents[customComponentName];
71 <Modal show size={size} type={type}>
72 <ModalHeader onClose={this.handleClose} type={type}>
73 {title && <ModalTitle>{title}</ModalTitle>}
75 {body && <ModalBody>{body}</ModalBody>}
77 <CustomComponent {...customComponentProps} />
81 actionButtonText={actionButtonText}
82 actionButtonClick={actionButtonClick}
83 closeButtonText={closeButtonText}
84 onClose={this.handleClose}
93 ModalWrapperView.propTypes = {
94 hideModal: PropTypes.func,
95 onClose: PropTypes.func,
96 modal: PropTypes.object
99 export default ModalWrapperView;