mirror of
https://github.com/twentyhq/twenty.git
synced 2024-11-22 03:17:40 +03:00
Move scroll left dependency in body
This commit is contained in:
parent
8e7f57139b
commit
b56ca5d979
@ -87,13 +87,6 @@ const StyledTable = styled.table<{
|
||||
left: 39px;
|
||||
}
|
||||
|
||||
tbody td:nth-of-type(1),
|
||||
tbody td:nth-of-type(2),
|
||||
tbody td:nth-of-type(3) {
|
||||
position: sticky;
|
||||
z-index: ${({ isScrolledLeft }) => (isScrolledLeft ? 3 : 2)};
|
||||
}
|
||||
|
||||
tbody td:nth-of-type(1) {
|
||||
left: 0;
|
||||
}
|
||||
@ -149,7 +142,7 @@ export const RecordTable = ({
|
||||
onColumnsChange,
|
||||
createRecord,
|
||||
}: RecordTableProps) => {
|
||||
const { scopeId, visibleTableColumnsSelector, isScrolledLeftSelector } =
|
||||
const { scopeId, visibleTableColumnsSelector } =
|
||||
useRecordTableStates(recordTableId);
|
||||
|
||||
const { objectMetadataItem } = useObjectMetadataItem({
|
||||
@ -211,8 +204,6 @@ export const RecordTable = ({
|
||||
|
||||
const visibleTableColumns = useRecoilValue(visibleTableColumnsSelector());
|
||||
|
||||
const isScrolledLeft = useRecoilValue(isScrolledLeftSelector());
|
||||
|
||||
return (
|
||||
<RecordTableScope
|
||||
recordTableScopeId={scopeId}
|
||||
@ -232,10 +223,7 @@ export const RecordTable = ({
|
||||
visibleTableColumns,
|
||||
}}
|
||||
>
|
||||
<StyledTable
|
||||
className="entity-table-cell"
|
||||
isScrolledLeft={isScrolledLeft}
|
||||
>
|
||||
<StyledTable className="entity-table-cell">
|
||||
<RecordTableHeader createRecord={createRecord} />
|
||||
<RecordTableBodyEffect objectNameSingular={objectNameSingular} />
|
||||
<RecordTableBody
|
||||
|
@ -18,8 +18,14 @@ type DraggableTableBodyProps = {
|
||||
recordTableId: string;
|
||||
};
|
||||
|
||||
const StyledTbody = styled.tbody`
|
||||
const StyledTbody = styled.tbody<{ isScrolledLeft?: boolean }>`
|
||||
overflow: hidden;
|
||||
td:nth-of-type(1),
|
||||
td:nth-of-type(2),
|
||||
td:nth-of-type(3) {
|
||||
position: sticky;
|
||||
z-index: ${({ isScrolledLeft }) => (isScrolledLeft ? 3 : 2)};
|
||||
}
|
||||
`;
|
||||
|
||||
export const DraggableTableBody = ({
|
||||
@ -29,7 +35,7 @@ export const DraggableTableBody = ({
|
||||
}: DraggableTableBodyProps) => {
|
||||
const [v4Persistable] = useState(v4());
|
||||
|
||||
const { tableRowIdsState } = useRecordTableStates();
|
||||
const { tableRowIdsState, isScrolledLeftSelector } = useRecordTableStates();
|
||||
|
||||
const tableRowIds = useRecoilValue(tableRowIdsState);
|
||||
|
||||
@ -67,12 +73,15 @@ export const DraggableTableBody = ({
|
||||
});
|
||||
};
|
||||
|
||||
const isScrolledLeft = useRecoilValue(isScrolledLeftSelector());
|
||||
|
||||
return (
|
||||
<DragDropContext onDragEnd={handleDragEnd}>
|
||||
<Droppable droppableId={v4Persistable}>
|
||||
{(provided) => (
|
||||
<StyledTbody
|
||||
ref={provided.innerRef}
|
||||
isScrolledLeft={isScrolledLeft}
|
||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
||||
{...provided.droppableProps}
|
||||
>
|
||||
|
Loading…
Reference in New Issue
Block a user