({column, state}: {column: any; state: any})
| 129 | } |
| 130 | |
| 131 | export function TableColumnHeader({column, state}: {column: any; state: any}): JSX.Element { |
| 132 | let ref = useRef<HTMLTableCellElement | null>(null); |
| 133 | let {columnHeaderProps} = useTableColumnHeader({node: column}, state, ref); |
| 134 | let {isFocusVisible, focusProps} = useFocusRing(); |
| 135 | let arrowIcon = state.sortDescriptor?.direction === 'ascending' ? '▲' : '▼'; |
| 136 | |
| 137 | return ( |
| 138 | <th |
| 139 | {...mergeProps(columnHeaderProps, focusProps)} |
| 140 | style={{ |
| 141 | textAlign: column.colSpan > 1 ? 'center' : 'left', |
| 142 | padding: '5px 10px', |
| 143 | outline: isFocusVisible ? '2px solid orange' : 'none', |
| 144 | cursor: 'default' |
| 145 | }} |
| 146 | ref={ref}> |
| 147 | {column.rendered} |
| 148 | {column.props.allowsSorting && ( |
| 149 | <span |
| 150 | aria-hidden="true" |
| 151 | style={{ |
| 152 | padding: '0 2px', |
| 153 | visibility: state.sortDescriptor?.column === column.key ? 'visible' : 'hidden' |
| 154 | }}> |
| 155 | {arrowIcon} |
| 156 | </span> |
| 157 | )} |
| 158 | </th> |
| 159 | ); |
| 160 | } |
| 161 | |
| 162 | export function TableRow({ |
| 163 | item, |
nothing calls this directly
no test coverage detected