-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created a specific scroll wrapper context per scroll wrapper and made…
… ScrollTop and ScrollLeft componentStates (#6645) @lucasbordeau @charlesBochet Issue #4826 Could u review this changes. Let me know what do you think. --------- Co-authored-by: Lucas Bordeau <[email protected]>
- Loading branch information
1 parent
0a77003
commit 1030ff4
Showing
26 changed files
with
205 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
packages/twenty-front/src/modules/ui/utilities/scroll/contexts/ScrollWrapperContexts.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { createContext, RefObject } from 'react'; | ||
|
||
type ScrollWrapperContextValue = { | ||
ref: RefObject<HTMLDivElement>; | ||
id: string; | ||
}; | ||
|
||
export type ContextProviderName = | ||
| 'eventList' | ||
| 'commandMenu' | ||
| 'recordBoard' | ||
| 'recordTableWithWrappers' | ||
| 'settingsPageContainer' | ||
| 'dropdownMenuItemsContainer' | ||
| 'showPageContainer' | ||
| 'showPageLeftContainer' | ||
| 'tabList' | ||
| 'releases' | ||
| 'test'; | ||
|
||
const createScrollWrapperContext = (id: string) => | ||
createContext<ScrollWrapperContextValue>({ | ||
ref: { current: null }, | ||
id, | ||
}); | ||
|
||
export const EventListScrollWrapperContext = | ||
createScrollWrapperContext('eventList'); | ||
export const CommandMenuScrollWrapperContext = | ||
createScrollWrapperContext('commandMenu'); | ||
export const RecordBoardScrollWrapperContext = | ||
createScrollWrapperContext('recordBoard'); | ||
export const RecordTableWithWrappersScrollWrapperContext = | ||
createScrollWrapperContext('recordTableWithWrappers'); | ||
export const SettingsPageContainerScrollWrapperContext = | ||
createScrollWrapperContext('settingsPageContainer'); | ||
export const DropdownMenuItemsContainerScrollWrapperContext = | ||
createScrollWrapperContext('dropdownMenuItemsContainer'); | ||
export const ShowPageContainerScrollWrapperContext = | ||
createScrollWrapperContext('showPageContainer'); | ||
export const ShowPageLeftContainerScrollWrapperContext = | ||
createScrollWrapperContext('showPageLeftContainer'); | ||
export const TabListScrollWrapperContext = | ||
createScrollWrapperContext('tabList'); | ||
export const ReleasesScrollWrapperContext = | ||
createScrollWrapperContext('releases'); | ||
export const TestScrollWrapperContext = createScrollWrapperContext('test'); | ||
|
||
export const getContextByProviderName = ( | ||
contextProviderName: ContextProviderName, | ||
) => { | ||
switch (contextProviderName) { | ||
case 'eventList': | ||
return EventListScrollWrapperContext; | ||
case 'commandMenu': | ||
return CommandMenuScrollWrapperContext; | ||
case 'recordBoard': | ||
return RecordBoardScrollWrapperContext; | ||
case 'recordTableWithWrappers': | ||
return RecordTableWithWrappersScrollWrapperContext; | ||
case 'settingsPageContainer': | ||
return SettingsPageContainerScrollWrapperContext; | ||
case 'dropdownMenuItemsContainer': | ||
return DropdownMenuItemsContainerScrollWrapperContext; | ||
case 'showPageContainer': | ||
return ShowPageContainerScrollWrapperContext; | ||
case 'showPageLeftContainer': | ||
return ShowPageLeftContainerScrollWrapperContext; | ||
case 'tabList': | ||
return TabListScrollWrapperContext; | ||
case 'releases': | ||
return ReleasesScrollWrapperContext; | ||
case 'test': | ||
return TestScrollWrapperContext; | ||
default: | ||
throw new Error('Context Provider not available'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.