@shopgate/engage
Version:
Shopgate's ENGAGE library.
39 lines (38 loc) • 1.27 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import { RippleButton, I18n, SurroundPortals } from '@shopgate/engage/components';
import { button, ripple } from "./ChangeLocationButton.style";
import { PRODUCT_FULFILLMENT_CHANGE_LOCATION } from "../../constants/Portals";
/**
* Renders the Change Location button.
* @param {Object} props The component props.
* @param {Function} props.onClick The click handler.
* @param {boolean} [props.disabled=false] Whether the button is disabled.
* @returns {JSX.Element} The rendered component.
*/
import { jsx as _jsx } from "react/jsx-runtime";
export const ChangeLocationButtonUnwrapped = ({
onClick,
disabled
}) => /*#__PURE__*/_jsx(SurroundPortals, {
portalName: PRODUCT_FULFILLMENT_CHANGE_LOCATION,
portalProps: {
onClick,
disabled
},
children: /*#__PURE__*/_jsx(RippleButton, {
onClick: onClick,
className: button,
disabled: disabled,
rippleClassName: ripple,
type: "secondary",
flat: true,
children: /*#__PURE__*/_jsx(I18n.Text, {
string: "locations.change_location"
})
})
});
ChangeLocationButtonUnwrapped.defaultProps = {
disabled: false
};
export const ChangeLocationButton = /*#__PURE__*/React.memo(ChangeLocationButtonUnwrapped);