@@ -340,11 +340,18 @@ export const PlanCardHeader = React.forwardRef<HTMLDivElement, PlanCardHeaderPro
340
340
341
341
interface PlanCardFeaturesListProps {
342
342
plan : __experimental_CommercePlanResource ;
343
+ /**
344
+ * @default false
345
+ */
343
346
isCompact ?: boolean ;
347
+ /**
348
+ * @default `checkmark`
349
+ */
350
+ variant ?: 'checkmark' | 'avatar' ;
344
351
}
345
352
346
353
export const PlanCardFeaturesList = React . forwardRef < HTMLDivElement , PlanCardFeaturesListProps > ( ( props , ref ) => {
347
- const { plan, isCompact } = props ;
354
+ const { plan, isCompact, variant = 'checkmark' } = props ;
348
355
const totalFeatures = plan . features . length ;
349
356
const [ showAllFeatures , setShowAllFeatures ] = React . useState ( false ) ;
350
357
const canToggleFeatures = isCompact && totalFeatures > 3 ;
@@ -354,10 +361,7 @@ export const PlanCardFeaturesList = React.forwardRef<HTMLDivElement, PlanCardFea
354
361
return (
355
362
< Box
356
363
ref = { ref }
357
- elementDescriptor = { descriptors . planCardFeaturesList }
358
- elementId = { isCompact ? descriptors . planCardFeaturesList . setId ( 'compact' ) : undefined }
359
- as = 'ul'
360
- role = 'list'
364
+ elementDescriptor = { descriptors . planCardFeatures }
361
365
sx = { t => ( {
362
366
display : 'grid' ,
363
367
flex : '1' ,
@@ -366,12 +370,17 @@ export const PlanCardFeaturesList = React.forwardRef<HTMLDivElement, PlanCardFea
366
370
>
367
371
< Box
368
372
elementDescriptor = { descriptors . planCardFeaturesList }
373
+ elementId = {
374
+ isCompact
375
+ ? descriptors . planCardFeaturesList . setId ( 'compact' )
376
+ : descriptors . planCardFeaturesList . setId ( variant )
377
+ }
369
378
as = 'ul'
370
379
role = 'list'
371
380
sx = { t => ( {
372
381
display : 'grid' ,
373
382
flex : '1' ,
374
- rowGap : isCompact ? t . space . $2 : t . space . $3 ,
383
+ rowGap : variant === 'avatar' ? t . space . $4 : isCompact ? t . space . $2 : t . space . $3 ,
375
384
} ) }
376
385
>
377
386
{ plan . features . slice ( 0 , showAllFeatures ? totalFeatures : 3 ) . map ( feature => (
@@ -383,19 +392,51 @@ export const PlanCardFeaturesList = React.forwardRef<HTMLDivElement, PlanCardFea
383
392
sx = { t => ( {
384
393
display : 'flex' ,
385
394
alignItems : 'baseline' ,
386
- gap : t . space . $2 ,
395
+ gap : variant === 'checkmark' ? t . space . $2 : t . space . $3 ,
387
396
} ) }
388
397
>
389
- < Icon
390
- icon = { Check }
391
- colorScheme = 'neutral'
392
- size = 'sm'
393
- aria-hidden
394
- sx = { t => ( {
395
- transform : `translateY(${ t . space . $0x25 } )` ,
396
- } ) }
397
- />
398
- < Text colorScheme = 'body' > { feature . description || feature . name } </ Text >
398
+ { variant === 'checkmark' ? (
399
+ < Icon
400
+ icon = { Check }
401
+ colorScheme = 'neutral'
402
+ size = 'sm'
403
+ aria-hidden
404
+ sx = { t => ( {
405
+ transform : `translateY(${ t . space . $0x25 } )` ,
406
+ } ) }
407
+ />
408
+ ) : feature . avatarUrl ? (
409
+ < Avatar
410
+ size = { _ => 24 }
411
+ title = { feature . name }
412
+ initials = { feature . name [ 0 ] }
413
+ rounded = { false }
414
+ imageUrl = { feature . avatarUrl }
415
+ />
416
+ ) : null }
417
+ < Span elementDescriptor = { descriptors . planCardFeaturesListItemContent } >
418
+ < Text
419
+ elementDescriptor = { descriptors . planCardFeaturesListItemTitle }
420
+ colorScheme = 'body'
421
+ sx = { t => ( {
422
+ fontWeight : variant === 'checkmark' ? t . fontWeights . $normal : t . fontWeights . $medium ,
423
+ } ) }
424
+ >
425
+ { feature . name }
426
+ </ Text >
427
+ { variant === 'avatar' && feature . description ? (
428
+ < Text
429
+ elementDescriptor = { descriptors . planCardFeaturesListItemDescription }
430
+ colorScheme = 'secondary'
431
+ sx = { t => ( {
432
+ marginBlockStart : t . space . $0x25 ,
433
+ fontSize : t . fontSizes . $xs ,
434
+ } ) }
435
+ >
436
+ { feature . description }
437
+ </ Text >
438
+ ) : null }
439
+ </ Span >
399
440
</ Box >
400
441
) ) }
401
442
</ Box >
0 commit comments