@citygross/components 0.7.55 → 0.7.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { TSummaryItem } from '../CartSummary/CartSummary';
2
2
  export declare type TCartItemSummary = {
3
3
  product: TSummaryItem;
4
+ withParenthesis?: boolean;
4
5
  };
5
- export declare function CartItemSummary({ product }: TCartItemSummary): JSX.Element;
6
+ export declare function CartItemSummary({ product, withParenthesis }: TCartItemSummary): JSX.Element;
@@ -14,17 +14,17 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
14
14
  var Skeleton__default = /*#__PURE__*/_interopDefaultLegacy(Skeleton);
15
15
 
16
16
  function CartItemSummary(_a) {
17
- var product = _a.product;
17
+ var product = _a.product, withParenthesis = _a.withParenthesis;
18
18
  return (React__default['default'].createElement(CartItemSummary_styles.CartItemSummaryWrapper, null,
19
19
  product &&
20
20
  (product.amount === 0 || product.amount) &&
21
21
  (product === null || product === void 0 ? void 0 : product.cancelledQuantity) !== 0 &&
22
22
  (product === null || product === void 0 ? void 0 : product.cancelledQuantity) && (React__default['default'].createElement(CartItemSummary_styles.CancelledWrapper, null,
23
23
  React__default['default'].createElement(typography.BodyText, { size: typography.TextTypes.TextSize.SMALL, lineThrough: true }, (product === null || product === void 0 ? void 0 : product.cancelledQuantity) ? (product.cancelledQuantity + " st") : (React__default['default'].createElement(Skeleton__default['default'], { width: 100 }))),
24
- React__default['default'].createElement(CartItemSummary_styles.AmountText, { lineThrough: true }, product ? (utils.formatPrice(product.cancelledAmount)) : (React__default['default'].createElement(Skeleton__default['default'], { width: 100 }))))),
24
+ React__default['default'].createElement(CartItemSummary_styles.AmountText, { lineThrough: true, fontWeight: withParenthesis ? 'regular' : 'semiBold' }, product ? (utils.formatPrice(product.cancelledAmount, withParenthesis)) : (React__default['default'].createElement(Skeleton__default['default'], { width: 100 }))))),
25
25
  React__default['default'].createElement(CartItemSummary_styles.ItemInformationContainer, null,
26
26
  React__default['default'].createElement(typography.BodyText, { size: typography.TextTypes.TextSize.SMALL }, (product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.quantity) === 0 ? (product.quantity + " st") : (React__default['default'].createElement(Skeleton__default['default'], { width: 100 }))),
27
- React__default['default'].createElement(CartItemSummary_styles.AmountText, null, product ? utils.formatPrice(product.amount) : React__default['default'].createElement(Skeleton__default['default'], { width: 100 })))));
27
+ React__default['default'].createElement(CartItemSummary_styles.AmountText, { fontWeight: withParenthesis ? 'regular' : 'semiBold' }, product ? (utils.formatPrice(product.amount, withParenthesis)) : (React__default['default'].createElement(Skeleton__default['default'], { width: 100 }))))));
28
28
  }
29
29
 
30
30
  exports.CartItemSummary = CartItemSummary;
@@ -18,12 +18,14 @@ function _interopDefaultLegacy$1 (e) { return e && typeof e === 'object' && 'def
18
18
 
19
19
  var React__default = /*#__PURE__*/_interopDefaultLegacy$1(React);
20
20
 
21
- var formatPrice = function (price) {
21
+ var formatPrice = function (price, withParenthesis) {
22
22
  if (price === null || price === undefined) {
23
23
  return;
24
24
  }
25
- var formattedPrice = (Math.round(price * 100) / 100).toFixed(2);
26
- return formattedPrice.replace('.', ',') + " kr";
25
+ var formattedPrice = (Math.round(price * 100) / 100)
26
+ .toFixed(2)
27
+ .replace('.', ',');
28
+ return (withParenthesis ? "(" + formattedPrice + ")" : formattedPrice) + " kr";
27
29
  };
28
30
 
29
31
  var capitalizeFirstLetter = function (string) {