({state, item, focusMode})
| 66 | } |
| 67 | |
| 68 | function Row({state, item, focusMode}) { |
| 69 | let rowRef = React.useRef(null); |
| 70 | let cellRef = React.useRef(null); |
| 71 | let cellNode = [...item.childNodes][0]; |
| 72 | let {rowProps} = useGridRow({node: item}, state, rowRef); |
| 73 | let {gridCellProps} = useGridCell( |
| 74 | { |
| 75 | node: cellNode, |
| 76 | focusMode |
| 77 | }, |
| 78 | state, |
| 79 | cellRef |
| 80 | ); |
| 81 | |
| 82 | let [isRowFocused, setRowFocused] = React.useState(false); |
| 83 | let {focusProps: rowFocusProps} = useFocus({ |
| 84 | onFocusChange: setRowFocused |
| 85 | }); |
| 86 | |
| 87 | let [isCellFocused, setCellFocused] = React.useState(false); |
| 88 | let {focusProps: cellFocusProps} = useFocus({ |
| 89 | onFocusChange: setCellFocused |
| 90 | }); |
| 91 | |
| 92 | return ( |
| 93 | <div |
| 94 | {...mergeProps(rowProps, rowFocusProps)} |
| 95 | ref={rowRef} |
| 96 | style={{outline: isRowFocused ? '2px solid red' : undefined}}> |
| 97 | <div |
| 98 | {...mergeProps(gridCellProps, cellFocusProps)} |
| 99 | ref={cellRef} |
| 100 | style={{outline: isCellFocused ? '2px solid green' : undefined}}> |
| 101 | {cellNode.rendered} |
| 102 | </div> |
| 103 | </div> |
| 104 | ); |
| 105 | } |
nothing calls this directly
no test coverage detected