@yorkjs/hive-ui 2.3.2 → 2.3.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorkjs/hive-ui",
3
- "version": "2.3.2",
3
+ "version": "2.3.3",
4
4
  "description": "Hive UI - Taro React component library",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
@@ -267,6 +267,25 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
267
267
  )
268
268
  }, [stockCount, saleCount, labels])
269
269
 
270
+ const remainingElem = useMemo(() => {
271
+ if (remainingCount == null || remainingCount === '') return null
272
+ return (
273
+ <View className={styles['remaining-box']}>
274
+ <Text className={styles['info-text']}>{labels.remaining_label}</Text>
275
+ <Text className={styles['remaining-value']}>{remainingCount}</Text>
276
+ {
277
+ remainingTotal != null && remainingTotal !== ''
278
+ ? (
279
+ <Text className={styles['remaining-total']}>
280
+ /{remainingTotal}
281
+ </Text>
282
+ )
283
+ : undefined
284
+ }
285
+ </View>
286
+ )
287
+ }, [remainingCount, remainingTotal, labels])
288
+
270
289
  return (
271
290
  <View
272
291
  className={formatClassNames(
@@ -314,13 +333,15 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
314
333
  {productTypeTag}
315
334
  <Text className={styles['title']} style={{ WebkitLineClamp: titleMaxLines }}>{title}</Text>
316
335
  </View>
317
- {(showMultipleSpec || stockCount || saleCount || barcode) && (
336
+ {(showMultipleSpec || stockCount || saleCount || barcode || remainingElem) && (
318
337
  <ScrollView scrollX className={styles['second-row']} showScrollbar={false}>
319
338
  <View className={styles['second-row-inner']}>
320
339
  {showMultipleSpec && <Text className={styles['primary-text']}>{labels.multiple_spec}</Text>}
321
340
  {showMultipleSpec && stockAndSaleElem && <View className={styles['info-line']} />}
322
341
  {stockAndSaleElem}
323
- {((showMultipleSpec || stockAndSaleElem) && barcode) && <View className={styles['info-line']} />}
342
+ {(showMultipleSpec || stockAndSaleElem) && remainingElem && <View className={styles['info-line']} />}
343
+ {remainingElem}
344
+ {((showMultipleSpec || stockAndSaleElem || remainingElem) && barcode) && <View className={styles['info-line']} />}
324
345
  {barcode && <Text className={styles['info-text']}>{labels.barcode_label} {barcode}</Text>}
325
346
  </View>
326
347
  </ScrollView>
@@ -357,29 +378,6 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
357
378
  )
358
379
  : undefined
359
380
  }
360
- {
361
- remainingCount != null && remainingCount !== ''
362
- ? (
363
- <View className={styles['remaining-row']}>
364
- <Text className={styles['remaining-label']}>
365
- {labels.remaining_label}:
366
- </Text>
367
- <Text className={styles['remaining-value']}>
368
- {remainingCount}
369
- </Text>
370
- {
371
- remainingTotal != null && remainingTotal !== ''
372
- ? (
373
- <Text className={styles['remaining-total']}>
374
- /{remainingTotal}
375
- </Text>
376
- )
377
- : undefined
378
- }
379
- </View>
380
- )
381
- : undefined
382
- }
383
381
  {
384
382
  customization
385
383
  ? (
@@ -482,4 +480,4 @@ const ProductItem: React.FC<IProductCardProps> = (props) => {
482
480
  )
483
481
  }
484
482
 
485
- export default React.memo(ProductItem)
483
+ export default React.memo(ProductItem)
@@ -205,26 +205,19 @@ $F_BUY_COUNT = 14PX // RN 14
205
205
  margin-top 5PX
206
206
  lineClamp(1)
207
207
 
208
- .remaining-row
208
+ .remaining-box
209
209
  display flex
210
210
  flex-direction row
211
- align-items baseline
212
- margin-top 5PX
213
-
214
- .remaining-label
215
- font-size $F_SPEC
216
- color var(--textContent)
217
- line-height 15PX
211
+ align-items center
218
212
 
219
213
  .remaining-value
220
- font-size $F_SPEC
214
+ font-size $F_INFO
221
215
  color var(--primary)
222
- line-height 15PX
216
+ margin-left 5PX
223
217
 
224
218
  .remaining-total
225
- font-size $F_SPEC
226
- color var(--textContent)
227
- line-height 15PX
219
+ font-size $F_INFO
220
+ color var(--textTitle)
228
221
 
229
222
  .customization-text
230
223
  font-size $F_CUSTOM
@@ -283,4 +276,4 @@ $F_BUY_COUNT = 14PX // RN 14
283
276
  color var(--textContent)
284
277
 
285
278
  .card-footer
286
- width 100%
279
+ width 100%