feat: improved table scrolling (#7731)

This PR fixes #7515

Demo:


https://github.com/user-attachments/assets/8181cda0-3b77-43bf-b605-ba43f2290b84
This commit is contained in:
ZiaCodes
2024-11-04 21:55:13 +05:00
committed by GitHub
parent 52e5f7daeb
commit 66c0aa5e52
5 changed files with 32 additions and 122 deletions

View File

@@ -2,7 +2,7 @@ import { Theme } from '@emotion/react';
import { Droppable } from '@hello-pangea/dnd';
import { styled } from '@linaria/react';
import { ReactNode, useContext, useState } from 'react';
import { ThemeContext } from 'twenty-ui';
import { MOBILE_VIEWPORT, ThemeContext } from 'twenty-ui';
import { v4 } from 'uuid';
const StyledTbody = styled.tbody<{
@@ -13,16 +13,32 @@ const StyledTbody = styled.tbody<{
position: sticky;
left: 0;
z-index: 5;
transition: 0.3s ease;
}
td:nth-of-type(2) {
position: sticky;
left: 9px;
left: 11px;
z-index: 5;
transition: 0.3s ease;
}
td:nth-of-type(3) {
position: sticky;
left: 39px;
left: 43px;
z-index: 5;
transition: 0.3s ease;
@media (max-width: ${MOBILE_VIEWPORT}px) {
& [data-testid='editable-cell-display-mode'] {
[data-testid='tooltip'] {
display: none;
}
[data-testid='chip'] {
gap: 0;
}
}
}
&::after {
content: '';
position: absolute;

View File

@@ -26,6 +26,7 @@ const StyledTd = styled.td<{
hasRightBorder ? borderColor : 'transparent'};
padding: 0;
transition: 0.3s ease;
text-align: left;

View File

@@ -26,16 +26,22 @@ const StyledTableHead = styled.thead`
position: sticky;
left: 0;
z-index: 5;
transition: 0.3s ease;
}
th:nth-of-type(2) {
position: sticky;
left: 9px;
left: 11px;
z-index: 5;
transition: 0.3s ease;
}
th:nth-of-type(3) {
position: sticky;
left: 39px;
left: 43px;
z-index: 5;
transition: 0.3s ease;
&::after {
content: '';
position: absolute;
@@ -46,9 +52,10 @@ const StyledTableHead = styled.thead`
box-shadow: ${({ theme }) => theme.boxShadow.light};
clip-path: inset(0px -4px 0px 0px);
}
@media (max-width: ${MOBILE_VIEWPORT}px) {
width: 30px;
max-width: 35px;
width: 34px;
max-width: 34px;
}
}
}

View File

@@ -31,6 +31,7 @@ const StyledColumnHeaderCell = styled.th<{
color: ${({ theme }) => theme.font.color.tertiary};
padding: 0;
text-align: left;
transition: 0.3s ease;
background-color: ${({ theme }) => theme.background.primary};
border-right: 1px solid ${({ theme }) => theme.border.color.light};