Skip to content

Commit

Permalink
Merge branch 'master' into sb-7
Browse files Browse the repository at this point in the history
  • Loading branch information
rushi authored Jan 21, 2024
2 parents 7a56416 + 6a615b4 commit 6acff89
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/Breakdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Breakdown.propTypes = {
};

const BreakdownItem = ({ children, info, methodIcon, secondary, value, className, color = "default", ...rest }) => {
const { currency, locale } = useContext(CurrencyContext);
/** When BreakdownItem is directly used without outer <Breakdown /> component, the context would be `undefined` */
const { currency, locale } = useContext(CurrencyContext) ?? {};

return (
<tr className={clsx("ui-breakdown-item", colors[color], className)} {...rest}>
Expand Down Expand Up @@ -78,7 +79,7 @@ Breakdown.Item = BreakdownItem;
Breakdown.Item.displayName = "Breakdown.Item";

const BreakdownSubtotalItem = ({ children, info, value, className, color = "black", ...rest }) => {
const { currency, locale } = useContext(CurrencyContext);
const { currency, locale } = useContext(CurrencyContext) ?? {};

return (
<tr className={clsx("ui-breakdown-subtotal-item", "font-bold", colors[color], className)} {...rest}>
Expand Down

0 comments on commit 6acff89

Please sign in to comment.