pcm-shared-components 2.0.3 → 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,13 +178,14 @@ 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
191
|
const toFloat_2_decimal = value => {
|