UNPKG

@shopgate/engage

Version:
37 lines (36 loc) 1.1 kB
import React, { useCallback } from 'react'; import { RippleButton, I18n } from '@shopgate/engage/components'; import { button, ripple } from "./CartItemCardReservationLabelChangeStore.style"; import { useCartItem } from "../CartItem"; /** * @returns {JSX} */ import { jsx as _jsx } from "react/jsx-runtime"; const CartItemCardReservationLabelChangeStore = () => { const { invokeFulfillmentAction, cartItem } = useCartItem(); const handleChangeLocationClick = useCallback(() => { if (!cartItem || !cartItem.fulfillment || !cartItem.fulfillment.method) { return; } const { fulfillment: { method } } = cartItem; invokeFulfillmentAction('changeLocation', method); }, [cartItem, invokeFulfillmentAction]); return /*#__PURE__*/_jsx(RippleButton, { onClick: handleChangeLocationClick, className: button, rippleClassName: ripple, type: "secondary", flat: true, children: /*#__PURE__*/_jsx(I18n.Text, { string: "locations.change_location" }) }); }; export default CartItemCardReservationLabelChangeStore;