aboutsummaryrefslogtreecommitdiffstats
path: root/src/react/ModalFooter.js
blob: 607895d56f83f85b8ee9b3b2938d99c79f10818e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from 'react';
import PropTypes from 'prop-types';
import Button from './Button.js';

const Footer = ({onClose, closeButtonText, actionButtonText, actionButtonClick, withButtons, children}) => {
	const closeBtnType = actionButtonClick ? 'secondary' : 'primary';
	return (
        <div className='sdc-modal__footer'>
            {children}   
            {                 
                withButtons && <div>
                    {actionButtonClick && 
                        <Button onClick={actionButtonClick}>{actionButtonText}</Button>        
                    }    
                    <Button btnType={closeBtnType}  onClick={onClose}>{closeButtonText}</Button>        
                </div>
            }
        </div>
	);
};

Footer.propTypes = {
	onClose: PropTypes.func,
	closeButtonText: PropTypes.string,
	actionButtonText: PropTypes.string,
	actionButtonClick: PropTypes.func,
	withButtons: PropTypes.bool,
	children: PropTypes.node
};

Footer.defaultProps = {
	closeButtonText: 'Close',
	withButtons: true
};

export default Footer;