wix-style-react
Version:
wix-style-react
81 lines (75 loc) • 2.51 kB
JavaScript
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import React from 'react';
import PropTypes from 'prop-types';
import Button from '../Backoffice/Button';
import * as styles from './FooterLayout.scss';
import classNames from 'classnames';
var FooterLayout = function FooterLayout(_ref) {
var bottomChildren = _ref.bottomChildren,
children = _ref.children,
theme = _ref.theme,
cancelText = _ref.cancelText,
onCancel = _ref.onCancel,
onOk = _ref.onOk,
confirmText = _ref.confirmText,
buttonsHeight = _ref.buttonsHeight,
enableOk = _ref.enableOk,
enableCancel = _ref.enableCancel,
sideActions = _ref.sideActions;
var footerButtonsClassNames = classNames(styles.footerbuttons, _defineProperty({}, styles.withSideActions, sideActions && (cancelText || confirmText)));
return React.createElement(
'div',
null,
React.createElement(
'div',
{ className: styles.footer, 'data-hook': 'message-box-footer' },
sideActions,
children,
React.createElement(
'div',
{ className: footerButtonsClassNames },
cancelText && React.createElement(Button, {
disabled: !enableCancel,
height: buttonsHeight,
theme: 'empty' + theme,
onClick: onCancel,
dataHook: 'cancellation-button',
children: cancelText
}),
confirmText && React.createElement(Button, {
disabled: !enableOk,
height: buttonsHeight,
theme: 'full' + theme,
onClick: onOk,
dataHook: 'confirmation-button',
children: confirmText
})
)
),
bottomChildren && React.createElement('div', {
'data-hook': 'footer-layout-bottom-children',
className: styles.bottomChildren,
children: bottomChildren
})
);
};
FooterLayout.propTypes = {
confirmText: PropTypes.node,
cancelText: PropTypes.node,
onCancel: PropTypes.func,
onOk: PropTypes.func,
enableOk: PropTypes.bool,
enableCancel: PropTypes.bool,
theme: PropTypes.string,
buttonsHeight: PropTypes.string,
children: PropTypes.any,
bottomChildren: PropTypes.node,
sideActions: PropTypes.node
};
FooterLayout.defaultProps = {
theme: 'blue',
buttonsHeight: 'small',
enableOk: true,
enableCancel: true
};
export default FooterLayout;