@yorkjs/hive-ui 0.0.5 → 0.0.6

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": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Hive UI - Taro React component library",
5
5
  "main": "src/index.ts",
6
6
  "module": "src/index.ts",
@@ -13,11 +13,19 @@ $F_BUY_COUNT = 14PX // RN 14
13
13
 
14
14
  .item-container
15
15
  position relative
16
- display flex
17
- flex-direction column
18
- padding 15PX 10PX // 对齐 RN: paddingVertical: 15, paddingHorizontal: 10
19
16
  background-color var(--containerCard)
17
+ padding 0 10PX
20
18
  box-sizing border-box
19
+ &.show-bottom-border
20
+ halfBorder(bottom, var(--lineBorder))
21
+
22
+ .card-info
23
+ display flex
24
+ flex-direction column
25
+ width 100%
26
+ padding 15PX 0
27
+ &.show-separator
28
+ halfBorder(bottom, var(--lineBorder))
21
29
 
22
30
  .card-main-body
23
31
  display flex
@@ -254,5 +262,4 @@ $F_BUY_COUNT = 14PX // RN 14
254
262
  color var(--textContent)
255
263
 
256
264
  .card-footer
257
- width 100%
258
- margin-top 12PX
265
+ width 100%
@@ -95,6 +95,10 @@ export interface IProductCardProps {
95
95
  action?: React.ReactNode
96
96
  /** 国际化标签注入 */
97
97
  labels?: IProductCardLabels
98
+ /** 是否显示底部分边框 */
99
+ showBottomBorder?: boolean
100
+ /** 是否显示底部分割线 */
101
+ showSeparator?: boolean
98
102
  // 卡片点击事件
99
103
  onClick?: () => void
100
104
  children?: React.ReactNode
@@ -143,6 +147,8 @@ const ProductCard: React.FC<IProductCardProps> = (props) => {
143
147
  onDelete,
144
148
  action,
145
149
  className,
150
+ showBottomBorder = false,
151
+ showSeparator = false,
146
152
  labels: customLabels,
147
153
  onClick,
148
154
  children
@@ -254,139 +260,155 @@ const ProductCard: React.FC<IProductCardProps> = (props) => {
254
260
  }, [stockCount, saleCount, labels])
255
261
 
256
262
  return (
257
- <View className={formatClassNames(styles['item-container'], className)} onClick={handleCardClick}>
258
- <View className={styles['card-main-body']}>
259
- {showCheckbox && (
260
- <View className={styles['checkbox-container']}>
261
- <Checkbox
262
- checked={checkboxChecked}
263
- disabled={checkboxDisabled}
264
- readOnly
265
- />
266
- </View>
267
- )}
268
- <View className={styles['image-container']}>
269
- <Image
270
- src={image?.url}
271
- className={styles['product-image']}
272
- mode='aspectFill'
273
- />
274
- {(showSoldOut || showOffline) && (
275
- <View className={styles['status-overlay']}>
276
- <Text className={styles['status-text']}>
277
- {showSoldOut ? labels.sold_out : labels.offline}
278
- </Text>
263
+ <View
264
+ className={formatClassNames(
265
+ styles['item-container'],
266
+ {
267
+ [styles['show-bottom-border']]: showBottomBorder,
268
+ },
269
+ className
270
+ )}
271
+ onClick={handleCardClick}
272
+ >
273
+ <View className={formatClassNames(
274
+ styles['card-info'],
275
+ {
276
+ [styles['show-separator']]: showSeparator
277
+ }
278
+ )}>
279
+ <View className={styles['card-main-body']}>
280
+ {showCheckbox && (
281
+ <View className={styles['checkbox-container']}>
282
+ <Checkbox
283
+ checked={checkboxChecked}
284
+ disabled={checkboxDisabled}
285
+ readOnly
286
+ />
279
287
  </View>
280
288
  )}
281
- </View>
282
- <View className={styles['content-container']}>
283
- <View className={styles['content-body']}>
284
- <View className={styles['title-row']} style={{ marginRight: showDelete ? '30PX' : '0' }}>
285
- {productTypeTag}
286
- <Text className={styles['title']} style={{ WebkitLineClamp: titleMaxLines }}>{title}</Text>
287
- </View>
288
- {(showMultipleSpec || stockCount || saleCount || barcode) && (
289
- <ScrollView scrollX className={styles['second-row']} showScrollbar={false}>
290
- <View className={styles['second-row-inner']}>
291
- {showMultipleSpec && <Text className={styles['primary-text']}>{labels.multiple_spec}</Text>}
292
- {showMultipleSpec && stockAndSaleElem && <View className={styles['info-line']} />}
293
- {stockAndSaleElem}
294
- {((showMultipleSpec || stockAndSaleElem) && barcode) && <View className={styles['info-line']} />}
295
- {barcode && <Text className={styles['info-text']}>{labels.barcode_label} {barcode}</Text>}
296
- </View>
297
- </ScrollView>
298
- )}
299
- {(activityType || deliveryTags) && (
300
- <View className={styles['tag-row']}>
301
- {activityType && labels.activity_type && (
302
- <View className={styles['activity-tag']}>
303
- {activityType === PROMOTION_ACTIVITY_TYPE_PRESENT && <View className={styles['activity-tag-badge']}><Text className={styles['activity-tag-badge-text']}>{labels.present_badge}</Text></View>}
304
- <View className={styles['activity-tag-content']}>
305
- <Text className={styles['activity-tag-text']}>
306
- {activityType === PROMOTION_ACTIVITY_TYPE_FLASH && labels.activity_type.flash}
307
- {activityType === PROMOTION_ACTIVITY_TYPE_BRAND && labels.activity_type.brand}
308
- {activityType === PROMOTION_ACTIVITY_TYPE_HOT && labels.activity_type.hot}
309
- {activityType === PROMOTION_ACTIVITY_TYPE_PRESENT && labels.activity_type.present}
310
- </Text>
311
- </View>
312
- </View>
313
- )}
314
- {deliveryTags}
289
+ <View className={styles['image-container']}>
290
+ <Image
291
+ src={image?.url}
292
+ className={styles['product-image']}
293
+ mode='aspectFill'
294
+ />
295
+ {(showSoldOut || showOffline) && (
296
+ <View className={styles['status-overlay']}>
297
+ <Text className={styles['status-text']}>
298
+ {showSoldOut ? labels.sold_out : labels.offline}
299
+ </Text>
315
300
  </View>
316
301
  )}
317
- {
318
- spec
319
- ? (
320
- <Text
321
- className={styles['spec-text']}
322
- style={{ WebkitLineClamp: specMaxLines }}
323
- >
324
- {labels.spec_label}:{spec}
325
- </Text>
326
- )
327
- : undefined
328
- }
329
- {
330
- customization
331
- ? (
332
- <Text
333
- className={styles['customization-text']}
334
- style={{ WebkitLineClamp: customizationMaxLines }}
335
- >
336
- {customization}
337
- </Text>
338
- )
339
- : undefined
340
- }
341
302
  </View>
342
- <View className={styles['content-bottom']}>
343
- <View className={styles['price-container']}>
344
- <View className={styles['price-row']}>
345
- <Text className={styles['price-symbol']}>
346
- ¥
347
- </Text>
348
- <Text className={styles['price-value']}>
349
- {salePrice}
350
- </Text>
303
+ <View className={styles['content-container']}>
304
+ <View className={styles['content-body']}>
305
+ <View className={styles['title-row']} style={{ marginRight: showDelete ? '30PX' : '0' }}>
306
+ {productTypeTag}
307
+ <Text className={styles['title']} style={{ WebkitLineClamp: titleMaxLines }}>{title}</Text>
351
308
  </View>
309
+ {(showMultipleSpec || stockCount || saleCount || barcode) && (
310
+ <ScrollView scrollX className={styles['second-row']} showScrollbar={false}>
311
+ <View className={styles['second-row-inner']}>
312
+ {showMultipleSpec && <Text className={styles['primary-text']}>{labels.multiple_spec}</Text>}
313
+ {showMultipleSpec && stockAndSaleElem && <View className={styles['info-line']} />}
314
+ {stockAndSaleElem}
315
+ {((showMultipleSpec || stockAndSaleElem) && barcode) && <View className={styles['info-line']} />}
316
+ {barcode && <Text className={styles['info-text']}>{labels.barcode_label} {barcode}</Text>}
317
+ </View>
318
+ </ScrollView>
319
+ )}
320
+ {(activityType || deliveryTags) && (
321
+ <View className={styles['tag-row']}>
322
+ {activityType && labels.activity_type && (
323
+ <View className={styles['activity-tag']}>
324
+ {activityType === PROMOTION_ACTIVITY_TYPE_PRESENT && <View className={styles['activity-tag-badge']}><Text className={styles['activity-tag-badge-text']}>{labels.present_badge}</Text></View>}
325
+ <View className={styles['activity-tag-content']}>
326
+ <Text className={styles['activity-tag-text']}>
327
+ {activityType === PROMOTION_ACTIVITY_TYPE_FLASH && labels.activity_type.flash}
328
+ {activityType === PROMOTION_ACTIVITY_TYPE_BRAND && labels.activity_type.brand}
329
+ {activityType === PROMOTION_ACTIVITY_TYPE_HOT && labels.activity_type.hot}
330
+ {activityType === PROMOTION_ACTIVITY_TYPE_PRESENT && labels.activity_type.present}
331
+ </Text>
332
+ </View>
333
+ </View>
334
+ )}
335
+ {deliveryTags}
336
+ </View>
337
+ )}
352
338
  {
353
- originalPrice
339
+ spec
354
340
  ? (
355
- <Text className={styles['original-price']}>
356
- ¥{originalPrice}
341
+ <Text
342
+ className={styles['spec-text']}
343
+ style={{ WebkitLineClamp: specMaxLines }}
344
+ >
345
+ {labels.spec_label}:{spec}
357
346
  </Text>
358
347
  )
359
348
  : undefined
360
349
  }
361
- </View>
362
- <View
363
- className={styles['action-area']}
364
- >
365
350
  {
366
- buyCount
351
+ customization
367
352
  ? (
368
- <Text className={styles['buy-count-value']}>
369
- x{buyCount}
353
+ <Text
354
+ className={styles['customization-text']}
355
+ style={{ WebkitLineClamp: customizationMaxLines }}
356
+ >
357
+ {customization}
370
358
  </Text>
371
359
  )
372
- : action
360
+ : undefined
373
361
  }
374
362
  </View>
363
+ <View className={styles['content-bottom']}>
364
+ <View className={styles['price-container']}>
365
+ <View className={styles['price-row']}>
366
+ <Text className={styles['price-symbol']}>
367
+ ¥
368
+ </Text>
369
+ <Text className={styles['price-value']}>
370
+ {salePrice}
371
+ </Text>
372
+ </View>
373
+ {
374
+ originalPrice
375
+ ? (
376
+ <Text className={styles['original-price']}>
377
+ ¥{originalPrice}
378
+ </Text>
379
+ )
380
+ : undefined
381
+ }
382
+ </View>
383
+ <View
384
+ className={styles['action-area']}
385
+ >
386
+ {
387
+ buyCount
388
+ ? (
389
+ <Text className={styles['buy-count-value']}>
390
+ x{buyCount}
391
+ </Text>
392
+ )
393
+ : action
394
+ }
395
+ </View>
396
+ </View>
375
397
  </View>
376
398
  </View>
399
+ {
400
+ children
401
+ ? (
402
+ <View
403
+ className={styles['card-footer']}
404
+ onClick={e => e.stopPropagation()}
405
+ >
406
+ {children}
407
+ </View>
408
+ )
409
+ : undefined
410
+ }
377
411
  </View>
378
- {
379
- children
380
- ? (
381
- <View
382
- className={styles['card-footer']}
383
- onClick={e => e.stopPropagation()}
384
- >
385
- {children}
386
- </View>
387
- )
388
- : undefined
389
- }
390
412
  {
391
413
  showDelete
392
414
  ? (