Skip to content

Commit

Permalink
feat: added text overrides on CartItem
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 87b788d
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions package/src/components/CartItem/v1/CartItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,28 @@ class CartItem extends Component {
/**
* Product URL path to be prepended before the slug
*/
productURLPath: PropTypes.string
productURLPath: PropTypes.string,
/**
* Text to display inside the remove button
*/
removeText: PropTypes.string,
/**
* The text for the "Remove" button text.
*/
removeText: PropTypes.string,
/**
* The text for the "Total" title text.
*/
totalText: PropTypes.string,
};

static defaultProps = {
isMiniCart: false,
isReadOnly: false,
onChangeCartItemQuantity() { },
onRemoveItemFromCart() { }
onRemoveItemFromCart() { },
removeText: "Remove",
totalText: "Total"
};

state = {
Expand Down Expand Up @@ -323,7 +337,8 @@ class CartItem extends Component {
quantity,
isLowQuantity,
price: { displayAmount: displayPrice },
subtotal
subtotal,
removeText
}
} = this.props;

Expand Down Expand Up @@ -368,7 +383,7 @@ class CartItem extends Component {
}
</ItemContentDetailInner>

{!isReadOnly && <ItemRemoveButton onClick={this.handleRemoveItemFromCart}>Remove</ItemRemoveButton>}
{!isReadOnly && <ItemRemoveButton onClick={this.handleRemoveItemFromCart}>{removeText}</ItemRemoveButton>}
</ItemContentDetail>
</ItemContent>
<ItemContentPrice isMiniCart={isMiniCart}>
Expand All @@ -379,7 +394,7 @@ class CartItem extends Component {
/>
{ quantity !== 1 ?
<ItemContentSubtotal isMiniCart={isMiniCart}>
<ItemContentSubtotalTitle>Total ({quantity}):</ItemContentSubtotalTitle>
<ItemContentSubtotalTitle>{totalText} ({quantity}):</ItemContentSubtotalTitle>
<ItemContentSubtotalDisplay>{displaySubtotal}</ItemContentSubtotalDisplay>
</ItemContentSubtotal>
:
Expand Down

0 comments on commit 87b788d

Please sign in to comment.