onTableSizeSelected(row + 1, col + 1)}
- />
- )
+ const onSizeHover = useCallback(
+ (selectedRows: number, selectedCols: number) => () => {
+ setTableSize({
+ rows: selectedRows,
+ columns: selectedCols
})
- ),
- [onTableSizeSelected, onSizeHover, t, tableSize]
- )
+ },
+ []
+ )
- const popoverRef = useRef
(null)
- useOnRefChange(popoverRef, (newRef) => onRefUpdate(newRef))
+ const tableContainer = useMemo(
+ () =>
+ createNumberRangeArray(8).map((row: number) =>
+ createNumberRangeArray(10).map((col: number) => {
+ const selected = tableSize && row < tableSize.rows && col < tableSize.columns
+ return (
+ onTableSizeSelected(row + 1, col + 1)}
+ />
+ )
+ })
+ ),
+ [onTableSizeSelected, onSizeHover, t, tableSize]
+ )
- return (
-
-
-
-
-
-
- {tableContainer}
-
-
-
-
-
-
- )
-}
+ return (
+
+
+
+
+
+
+ {tableContainer}
+
+
+
+
+
+
+ )
+ }
+)
+
+TableSizePickerPopover.displayName = 'TableSizePickerPopover'