Scroll behavior part 2 (#1304)

* Fix layout issues introduced by scroll behavior

* Complete scrollbar work
This commit is contained in:
Charles Bochet
2023-08-25 12:38:45 +02:00
committed by GitHub
parent 0d210244db
commit de569f4c06
11 changed files with 162 additions and 92 deletions

View File

@ -8,8 +8,7 @@ import type {
import { SortType } from '@/ui/filter-n-sort/types/interface';
import { DragSelect } from '@/ui/utilities/drag-select/components/DragSelect';
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
import { StyledScrollWrapper } from '@/ui/utilities/scroll/components/StyledScrollWrapper';
import { useListenScroll } from '@/ui/utilities/scroll/hooks/useListenScroll';
import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';
import { EntityUpdateMutationContext } from '../contexts/EntityUpdateMutationHookContext';
import { useLeaveTableFocus } from '../hooks/useLeaveTableFocus';
@ -125,12 +124,6 @@ export function EntityTable<SortField>({
},
});
const scrollableRef = useRef<HTMLDivElement>(null);
useListenScroll({
scrollableRef,
});
return (
<EntityUpdateMutationContext.Provider value={updateEntityMutation}>
<StyledTableWithHeader>
@ -143,12 +136,14 @@ export function EntityTable<SortField>({
onViewSubmit={onViewSubmit}
onImport={onImport}
/>
<StyledScrollWrapper ref={scrollableRef}>
<StyledTable>
<EntityTableHeader onColumnsChange={onColumnsChange} />
<EntityTableBody />
</StyledTable>
</StyledScrollWrapper>
<ScrollWrapper>
<div>
<StyledTable>
<EntityTableHeader onColumnsChange={onColumnsChange} />
<EntityTableBody />
</StyledTable>
</div>
</ScrollWrapper>
<DragSelect
dragSelectable={tableBodyRef}
onDragSelectionStart={resetTableRowSelection}