({
checked,
title,
description,
onCheckboxToggle,
className,
icon: Icon,
}: CustomCheckboxProps)
| 20 | } |
| 21 | |
| 22 | export const CardCheckbox = ({ |
| 23 | checked, |
| 24 | title, |
| 25 | description, |
| 26 | onCheckboxToggle, |
| 27 | className, |
| 28 | icon: Icon, |
| 29 | }: CustomCheckboxProps): ReactElement => { |
| 30 | return ( |
| 31 | // A multi-select set, so `checkbox`, not a pressed toggle button. This ARIA |
| 32 | // is all assistive tech gets — there is no real input behind it. |
| 33 | <button |
| 34 | type="button" |
| 35 | role="checkbox" |
| 36 | aria-checked={checked} |
| 37 | onClick={onCheckboxToggle} |
| 38 | data-funnel-track={FunnelTargetId.FeedContentType} |
| 39 | className={classNames( |
| 40 | 'group flex w-full items-start gap-3 rounded-16 border p-4 text-left transition-all duration-200', |
| 41 | 'hover:-translate-y-0.5 hover:shadow-2 active:translate-y-0 active:scale-[0.99] motion-reduce:transform-none', |
| 42 | checked |
| 43 | ? 'border-accent-cabbage-default bg-accent-cabbage-flat' |
| 44 | : 'border-border-subtlest-tertiary hover:bg-surface-hover', |
| 45 | className, |
| 46 | )} |
| 47 | > |
| 48 | {Icon && ( |
| 49 | <span |
| 50 | aria-hidden |
| 51 | className={classNames( |
| 52 | 'flex size-8 shrink-0 items-center justify-center rounded-10 transition-colors', |
| 53 | checked |
| 54 | ? 'bg-accent-cabbage-default text-white' |
| 55 | : 'bg-surface-float text-text-tertiary', |
| 56 | )} |
| 57 | > |
| 58 | <Icon size={IconSize.Small} secondary={checked} /> |
| 59 | </span> |
| 60 | )} |
| 61 | <span className="flex min-w-0 flex-1 flex-col gap-0.5"> |
| 62 | <Typography bold type={TypographyType.Callout}> |
| 63 | {title} |
| 64 | </Typography> |
| 65 | <Typography |
| 66 | type={TypographyType.Footnote} |
| 67 | color={TypographyColor.Secondary} |
| 68 | className="[text-wrap:pretty]" |
| 69 | > |
| 70 | {description} |
| 71 | </Typography> |
| 72 | </span> |
| 73 | <span |
| 74 | aria-hidden |
| 75 | className={classNames( |
| 76 | 'mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full transition-colors', |
| 77 | checked |
| 78 | ? 'bg-accent-cabbage-default text-white' |
| 79 | : // The empty ring is the only thing marking an unselected card as |
nothing calls this directly
no outgoing calls
no test coverage detected