({ row })
| 387 | |
| 388 | export function getExpandCell({ onClick, title }) { |
| 389 | const Cell = ({ row }) => { |
| 390 | const onClickFinal = (e) => { |
| 391 | e.preventDefault(); |
| 392 | row.toggleExpanded(); |
| 393 | onClick?.(row, e); |
| 394 | }; |
| 395 | return ( |
| 396 | <PgIconButton |
| 397 | size="xs" |
| 398 | icon={ |
| 399 | row.getIsExpanded() ? ( |
| 400 | <KeyboardArrowDownIcon /> |
| 401 | ) : ( |
| 402 | <ChevronRightIcon /> |
| 403 | ) |
| 404 | } |
| 405 | noBorder |
| 406 | onClick={onClickFinal} |
| 407 | aria-label={title} |
| 408 | /> |
| 409 | ); |
| 410 | }; |
| 411 | |
| 412 | Cell.displayName = 'ExpandCell'; |
| 413 | Cell.propTypes = { |