Skip to content

Commit

Permalink
feat: added text overrides on MiniCart
Browse files Browse the repository at this point in the history
Signed-off-by: Haris Spahija <haris.spahija@pon.com>
  • Loading branch information
HarisSpahijaPon committed Nov 21, 2019
1 parent 4808ec2 commit 41166ed
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions package/src/components/MiniCart/v1/MiniCart.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ class MiniCart extends Component {
*/
items: PropTypes.arrayOf(PropTypes.object).isRequired
}),
/**
* The text for the "Checkout" button text.
*/
checkoutButtonText: PropTypes.string,
/**
* You can provide a `className` prop that will be applied to the outermost DOM element
* rendered by this component. We do not recommend using this for styling purposes, but
Expand Down Expand Up @@ -127,6 +131,10 @@ class MiniCart extends Component {
*/
MiniCartSummary: CustomPropTypes.component.isRequired
}),
/**
* The text for the "Shipping and tax calculated in checkout" message text.
*/
footerMessageText: PropTypes.string,
/**
* On cart item quantity change handler
*/
Expand All @@ -148,14 +156,18 @@ class MiniCart extends Component {
static defaultProps = {
onChangeCartItemQuantity() {},
onCheckoutButtonClick() {},
onRemoveItemFromCart() {}
onRemoveItemFromCart() {},
checkoutButtonText: "Checkout",
footerMessageText: "Shipping and tax calculated in checkout"
};

render() {
const {
cart: { checkout: { summary }, items },
className,
checkoutButtonText,
components: { Button, CartCheckoutButton, CartItems, MiniCartSummary },
footerMessageText.
onCheckoutButtonClick,
...props
} = this.props;
Expand All @@ -168,10 +180,10 @@ class MiniCart extends Component {
<MiniCartSummary displaySubtotal={summary.itemTotal.displayAmount} />
{(CartCheckoutButton && <CartCheckoutButton onClick={onCheckoutButtonClick} />) || (
<Button actionType="important" isFullWidth onClick={onCheckoutButtonClick}>
Checkout
{checkoutButtonText}
</Button>
)}
<FooterMessage>Shipping and tax calculated in checkout</FooterMessage>
<FooterMessage>{footerMessageText}</FooterMessage>
</Footer>
</Cart>
);
Expand Down

0 comments on commit 41166ed

Please sign in to comment.