Skip to content

Commit 96a67e7

Browse files
Devices pagination
1 parent 840cf62 commit 96a67e7

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/components/Organisms/DevicesList/DevicesList.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Table, { TableSelectionPanel } from '../../Atomic/TableNew'
66
import { DEVICES_DEFAULT_PAGE_SIZE } from '../../../common/constants'
77
import { Props, defaultProps } from './DevicesList.types'
88
import { useIsMounted } from '../../../common/hooks'
9+
import { useResizeDetector } from 'react-resize-detector'
910

1011
const DevicesList: FC<Props> = (props) => {
1112
const {
@@ -26,9 +27,20 @@ const DevicesList: FC<Props> = (props) => {
2627
const validData = useCallback((data: any) => (!data || data[0] === undefined ? [] : data), [])
2728
const selectedCount = useMemo(() => Object.keys(selectedDevices).length, [selectedDevices])
2829
const isMounted = useIsMounted()
30+
const { ref, height } = useResizeDetector({
31+
refreshRate: 500,
32+
})
2933

3034
return (
31-
<>
35+
<div
36+
ref={ref}
37+
style={{
38+
height: '100%',
39+
display: 'flex',
40+
flexDirection: 'column',
41+
overflow: 'hidden',
42+
}}
43+
>
3244
<Table
3345
columns={columns}
3446
data={validData(data)}
@@ -39,6 +51,7 @@ const DevicesList: FC<Props> = (props) => {
3951
desc: false,
4052
},
4153
]}
54+
height={height}
4255
i18n={{
4356
search: i18n.search,
4457
}}
@@ -69,7 +82,7 @@ const DevicesList: FC<Props> = (props) => {
6982
document.querySelector('#modal-root') as Element
7083
)}
7184
{customContent}
72-
</>
85+
</div>
7386
)
7487
}
7588

0 commit comments

Comments
 (0)