feat: table virtualization (#1408)
* feat: poc table virtualization * feat: table virtualization * feat: add overscan of 15 * fix: increase overscan to 50 * fix: dead code * fix: debug mode * feat: styled space
This commit is contained in:
@ -1,8 +1,12 @@
|
||||
import { useRef } from 'react';
|
||||
import { createContext, RefObject, useRef } from 'react';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { useListenScroll } from '../hooks/useListenScroll';
|
||||
|
||||
export const ScrollWrapperContext = createContext<RefObject<HTMLDivElement>>({
|
||||
current: null,
|
||||
});
|
||||
|
||||
const StyledScrollWrapper = styled.div`
|
||||
display: flex;
|
||||
height: 100%;
|
||||
@ -28,8 +32,10 @@ export function ScrollWrapper({ children, className }: ScrollWrapperProps) {
|
||||
});
|
||||
|
||||
return (
|
||||
<StyledScrollWrapper ref={scrollableRef} className={className}>
|
||||
{children}
|
||||
</StyledScrollWrapper>
|
||||
<ScrollWrapperContext.Provider value={scrollableRef}>
|
||||
<StyledScrollWrapper ref={scrollableRef} className={className}>
|
||||
{children}
|
||||
</StyledScrollWrapper>
|
||||
</ScrollWrapperContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user