[Dashboards] - Add scroll wrapper (#14561)
## Summary - Fixed nested scrolls and sticky tabs in dashboard view - Drag select now auto-scrolls via ScrollWrapper context ## Changes - Wrapped content in ScrollWrapper which provides context ID automatically - Removed overflow from grid container to fix nested scrolls
This commit is contained in:
@@ -32,8 +32,6 @@ const StyledGridContainer = styled.div`
|
||||
box-sizing: border-box;
|
||||
flex: 1;
|
||||
min-height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
position: relative;
|
||||
padding: ${({ theme }) => theme.spacing(2)};
|
||||
width: 100%;
|
||||
|
||||
+22
-3
@@ -2,13 +2,27 @@ import { PageLayoutGridLayout } from '@/page-layout/components/PageLayoutGridLay
|
||||
import { useCurrentPageLayout } from '@/page-layout/hooks/useCurrentPageLayout';
|
||||
import { getTabListInstanceIdFromPageLayoutId } from '@/page-layout/utils/getTabListInstanceIdFromPageLayoutId';
|
||||
import { TabList } from '@/ui/layout/tab-list/components/TabList';
|
||||
import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';
|
||||
import styled from '@emotion/styled';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
background: ${({ theme }) => theme.background.primary};
|
||||
`;
|
||||
|
||||
const StyledTabList = styled(TabList)`
|
||||
padding-left: ${({ theme }) => theme.spacing(2)};
|
||||
`;
|
||||
|
||||
const StyledScrollWrapper = styled(ScrollWrapper)`
|
||||
flex: 1;
|
||||
`;
|
||||
|
||||
export const PageLayoutRendererContent = () => {
|
||||
const { currentPageLayout } = useCurrentPageLayout();
|
||||
|
||||
@@ -17,7 +31,7 @@ export const PageLayoutRendererContent = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<StyledContainer>
|
||||
<StyledTabList
|
||||
tabs={currentPageLayout.tabs}
|
||||
behaveAsLinks={false}
|
||||
@@ -25,7 +39,12 @@ export const PageLayoutRendererContent = () => {
|
||||
currentPageLayout.id,
|
||||
)}
|
||||
/>
|
||||
<PageLayoutGridLayout />
|
||||
</>
|
||||
<StyledScrollWrapper
|
||||
componentInstanceId={`scroll-wrapper-page-layout-${currentPageLayout.id}`}
|
||||
defaultEnableXScroll={false}
|
||||
>
|
||||
<PageLayoutGridLayout />
|
||||
</StyledScrollWrapper>
|
||||
</StyledContainer>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user