Skip to content

Commit

Permalink
feat: added text overrides on CartItemDetail
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 27, 2019
1 parent 77d7ae0 commit f368bd4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions package/src/components/CartItemDetail/v1/CartItemDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,20 @@ class CartItemDetail extends Component {
* Item quantity
*/
quantity: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
/**
* The text for the "Quantity" label text.
*/
quantityText: PropTypes.string,
/**
* Product title of chosen item.
*/
title: PropTypes.string
};

static defaultProps: {
quantityText: "Quantity"
}

renderBlockAttributes() {
const { attributes } = this.props;

Expand Down Expand Up @@ -112,15 +120,15 @@ class CartItemDetail extends Component {
}

renderAttributes() {
const { attributes, isMiniCart, productVendor, quantity } = this.props;
const { attributes, isMiniCart, productVendor, quantity, quantityText } = this.props;

if ((!attributes || attributes.length === 0) && !productVendor) return null;

return (
<Attributes isMiniCart={isMiniCart}>
{productVendor ? <Text>{productVendor}</Text> : null}
{isMiniCart ? this.renderInlineAttributes() : this.renderBlockAttributes()}
{quantity ? <Text>Quantity: {quantity}</Text> : null}
{quantity ? <Text>{quantityText}: {quantity}</Text> : null}
</Attributes>
);
}
Expand Down

0 comments on commit f368bd4

Please sign in to comment.