pcm-shared-components 2.0.2 → 2.0.4
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.
|
@@ -39,6 +39,10 @@ const useStyles = makeStyles(theme => ({
|
|
|
39
39
|
maxHeight: ({
|
|
40
40
|
PRODUCT_BUTTON_HEIGHT
|
|
41
41
|
}) => PRODUCT_BUTTON_HEIGHT,
|
|
42
|
+
paddingRight: ({
|
|
43
|
+
hasImage,
|
|
44
|
+
isTierPricing
|
|
45
|
+
}) => hasImage && isTierPricing ? 0 : undefined,
|
|
42
46
|
textAlign: 'center',
|
|
43
47
|
fontSize: 16,
|
|
44
48
|
borderRadius: 5,
|
|
@@ -55,6 +59,10 @@ const useStyles = makeStyles(theme => ({
|
|
|
55
59
|
maxHeight: ({
|
|
56
60
|
PRODUCT_BUTTON_HEIGHT
|
|
57
61
|
}) => PRODUCT_BUTTON_HEIGHT,
|
|
62
|
+
paddingRight: ({
|
|
63
|
+
hasImage,
|
|
64
|
+
isTierPricing
|
|
65
|
+
}) => hasImage && isTierPricing ? 0 : undefined,
|
|
58
66
|
textAlign: 'center',
|
|
59
67
|
borderRadius: 5,
|
|
60
68
|
backgroundColor: theme.palette && theme.palette.action.focus ? theme.palette.action.focus : undefined,
|
|
@@ -85,7 +93,7 @@ const useStyles = makeStyles(theme => ({
|
|
|
85
93
|
textOverflow: 'ellipsis'
|
|
86
94
|
},
|
|
87
95
|
productTirePrice: {
|
|
88
|
-
fontSize:
|
|
96
|
+
fontSize: 14,
|
|
89
97
|
lineHeight: 1.3,
|
|
90
98
|
"-webkit-line-clamp": 1,
|
|
91
99
|
WebkitLineClamp: 1,
|
|
@@ -148,7 +156,9 @@ export const ProductItemButton = props => {
|
|
|
148
156
|
PRODUCT_BUTTON_GUTTER,
|
|
149
157
|
PRODUCT_BUTTON_HEIGHT,
|
|
150
158
|
PRODUCT_SMALL_BUTTON_WIDTH,
|
|
151
|
-
PRODUCT_LARGE_BUTTON_WIDTH
|
|
159
|
+
PRODUCT_LARGE_BUTTON_WIDTH,
|
|
160
|
+
hasImage: productData.pictures && productData.pictures.length > 0 ? true : false,
|
|
161
|
+
isTierPricing: Number(productData.is_unit_pricing) !== 1 ? true : false
|
|
152
162
|
});
|
|
153
163
|
const compTheme = theme ? theme : useTheme();
|
|
154
164
|
const defaultTheme = createTheme(compTheme); //---------------------------------------------------
|
|
@@ -168,23 +178,20 @@ export const ProductItemButton = props => {
|
|
|
168
178
|
price,
|
|
169
179
|
sub_title
|
|
170
180
|
}) => {
|
|
171
|
-
|
|
181
|
+
const thisPrice = toFloat_2_decimal(price);
|
|
182
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, parseFloat(thisPrice) > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
172
183
|
className: clsx('flex flex-col mx-auto')
|
|
173
184
|
}, /*#__PURE__*/React.createElement("p", {
|
|
174
185
|
className: clsx(classes.productTirePrice, 'p-0 my-0 mx-auto ')
|
|
175
|
-
},
|
|
186
|
+
}, toFloat_2_decimal(price)), /*#__PURE__*/React.createElement("p", {
|
|
176
187
|
className: clsx(classes.tierPriceSubtitle, ' mx-auto ')
|
|
177
|
-
}, sub_title));
|
|
188
|
+
}, sub_title)) : /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
178
189
|
};
|
|
179
190
|
|
|
180
|
-
const toFloat_2_decimal =
|
|
191
|
+
const toFloat_2_decimal = value => {
|
|
181
192
|
try {
|
|
182
193
|
if (value) {
|
|
183
194
|
value = parseFloat(Math.round(value * 100) / 100).toFixed(2);
|
|
184
|
-
|
|
185
|
-
if (with_thousand_separators) {
|
|
186
|
-
value = thousandsSeparators(value);
|
|
187
|
-
}
|
|
188
195
|
}
|
|
189
196
|
} catch (e) {
|
|
190
197
|
console.error(e.message);
|
|
@@ -193,14 +200,10 @@ export const ProductItemButton = props => {
|
|
|
193
200
|
return value;
|
|
194
201
|
};
|
|
195
202
|
|
|
196
|
-
const toFloat_0_decimal =
|
|
203
|
+
const toFloat_0_decimal = value => {
|
|
197
204
|
try {
|
|
198
205
|
if (value) {
|
|
199
206
|
value = parseFloat(Math.round(value * 100) / 100).toFixed(0);
|
|
200
|
-
|
|
201
|
-
if (with_thousand_separators) {
|
|
202
|
-
value = thousandsSeparators(value);
|
|
203
|
-
}
|
|
204
207
|
}
|
|
205
208
|
} catch (e) {
|
|
206
209
|
console.error(e.message);
|
|
@@ -238,7 +241,7 @@ export const ProductItemButton = props => {
|
|
|
238
241
|
title: productData.description,
|
|
239
242
|
arrow: true
|
|
240
243
|
}, /*#__PURE__*/React.createElement(InfoIcon, {
|
|
241
|
-
fontSize: "
|
|
244
|
+
fontSize: "normal"
|
|
242
245
|
})))), productData.pictures && productData.pictures.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
243
246
|
className: "absolute left-0 -ml-10 z-99",
|
|
244
247
|
style: {
|