({ items }: { items: RowItem[] })
| 316 | ); |
| 317 | |
| 318 | export const SheetChoice = ({ items }: { items: RowItem[] }): ReactElement => ( |
| 319 | <div className="flex flex-col py-1"> |
| 320 | {items.map((item) => { |
| 321 | const className = classNames( |
| 322 | 'flex h-12 w-full items-center px-4 text-left transition-colors typo-callout hover:bg-surface-hover', |
| 323 | item.active ? 'font-bold text-text-primary' : 'text-text-primary', |
| 324 | ); |
| 325 | const mark = item.active && ( |
| 326 | <span className="ml-auto size-2 rounded-2 bg-text-primary" /> |
| 327 | ); |
| 328 | |
| 329 | if (item.href) { |
| 330 | return ( |
| 331 | <Link |
| 332 | key={item.key} |
| 333 | href={item.href} |
| 334 | passHref |
| 335 | replace={item.replace} |
| 336 | scroll={item.keepScroll ? false : undefined} |
| 337 | > |
| 338 | <a |
| 339 | aria-current={item.active ? 'page' : undefined} |
| 340 | onClick={item.onClick} |
| 341 | // eslint-disable-next-line jsx-a11y/no-redundant-roles |
| 342 | role="link" |
| 343 | tabIndex={0} |
| 344 | onKeyDown={(event) => { |
| 345 | if (event.key === ' ') { |
| 346 | event.preventDefault(); |
| 347 | event.currentTarget.click(); |
| 348 | } |
| 349 | }} |
| 350 | className={className} |
| 351 | > |
| 352 | {item.label} |
| 353 | {mark} |
| 354 | </a> |
| 355 | </Link> |
| 356 | ); |
| 357 | } |
| 358 | |
| 359 | return ( |
| 360 | <button |
| 361 | key={item.key} |
| 362 | type="button" |
| 363 | aria-pressed={item.active} |
| 364 | onClick={item.onClick} |
| 365 | className={className} |
| 366 | > |
| 367 | {item.label} |
| 368 | {mark} |
| 369 | </button> |
| 370 | ); |
| 371 | })} |
| 372 | </div> |
| 373 | ); |
nothing calls this directly
no outgoing calls
no test coverage detected