wix-style-react
Version:
51 lines (48 loc) • 1.37 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import React from 'react';
import PropTypes from 'prop-types';
import Button from '../../Button';
import TextButton from '../../TextButton';
import { dataHooks } from '../constants';
import { classes } from '../Notification.st.css';
var ActionButton = function ActionButton(_ref) {
var children = _ref.children,
onClick = _ref.onClick,
type = _ref.type,
link = _ref.link,
target = _ref.target;
var commonProps = {
dataHook: dataHooks.notificationCtaButton,
onClick: onClick
};
if (type === 'textLink') {
return /*#__PURE__*/React.createElement(TextButton, _extends({
className: classes.textLink,
underline: "always",
skin: "light",
as: "a",
href: link,
target: target
}, commonProps), children);
} else {
return /*#__PURE__*/React.createElement(Button, _extends({
className: classes.button,
type: "button",
size: "small",
skin: "transparent"
}, commonProps), children);
}
};
ActionButton.propTypes = {
children: PropTypes.any,
onClick: PropTypes.func,
link: PropTypes.string,
type: PropTypes.string,
target: PropTypes.string
};
ActionButton.defaultProps = {
type: 'button',
target: '_self'
};
ActionButton.displayName = 'Notification.ActionButton';
export default ActionButton;