wix-style-react
Version:
wix-style-react
56 lines (48 loc) • 1.43 kB
JavaScript
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
import React from 'react';
import PropTypes from 'prop-types';
import Button from '../../Backoffice/Button';
import TextLink from '../../TextLink';
var ActionButton = function ActionButton(_ref) {
var children = _ref.children,
_onClick = _ref.onClick,
type = _ref.type,
link = _ref.link;
var commonProps = {
dataHook: 'notification-cta-button',
onClick: function onClick(e) {
return _onClick(e);
}
};
if (type === 'textLink') {
return React.createElement(
TextLink,
_extends({
underlineStyle: 'always',
theme: 'darkBackground',
link: link
}, commonProps),
children
);
} else {
return React.createElement(
Button,
_extends({ height: 'small', theme: 'transparent' }, commonProps),
children
);
}
};
ActionButton.propTypes = {
children: PropTypes.any,
onClick: PropTypes.func,
link: PropTypes.string,
type: PropTypes.string
};
ActionButton.defaultProps = {
onClick: function onClick(e) {
return e.preventDefault();
},
type: 'button'
};
ActionButton.displayName = 'Notification.ActionButton';
export default ActionButton;