Skip to content

Commit

Permalink
feat: added text overrides on MiniCartSummary
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 83e9e61
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions package/src/components/MiniCartSummary/v1/MiniCartSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,29 +44,42 @@ class MiniCartSummary extends Component {
/**
* The computed taxes for items in the cart.
*/
displayTax: PropTypes.string
displayTax: PropTypes.string,
/**
* The text for the "Tax" label text.
*/
taxLabelText: PropTypes.string,
/**
* The text for the "Subtotal" label text.
*/
subtotalLabelText: PropTypes.string,
};

static defaultProps = {
taxLabelText: "Tax",
subtotalLabelText: "Subtotal",
}

renderTax = () => {
const { displayTax } = this.props;
const { displayTax, taxLabelText } = this.props;

return (
<tr>
<Td>Tax</Td>
<Td>{taxLabelText}</Td>
<TdValue>{displayTax}</TdValue>
</tr>
);
};

render() {
const { className, displaySubtotal, displayTax } = this.props;
const { className, displaySubtotal, displayTax, subtotalLabelText } = this.props;
const taxes = displayTax && this.renderTax();

return (
<Table className={className}>
<tbody>
<tr>
<Td>Subtotal</Td>
<Td>{subtotalLabelText}</Td>
<TdValue>{displaySubtotal}</TdValue>
</tr>
{taxes}
Expand Down

0 comments on commit 83e9e61

Please sign in to comment.