mirror of
https://github.com/lingble/twenty.git
synced 2025-10-29 11:52:28 +00:00
fix: Minor bug in column scroll in mobile viewport (#7448)
> [!Note] > - This PR fixes #7447 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@@ -38,6 +38,6 @@ export const Default: Story = {
|
||||
await canvas.findByText('Tasks');
|
||||
await canvas.findByText('People');
|
||||
await canvas.findByText('Opportunities');
|
||||
await canvas.findByText('My Customs');
|
||||
await canvas.findByText('Rockets');
|
||||
},
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ const meta: Meta<typeof EventRowMainObjectUpdated> = {
|
||||
},
|
||||
} as TimelineActivity,
|
||||
mainObjectMetadataItem: generatedMockObjectMetadataItems.find(
|
||||
(item) => item.namePlural === 'person',
|
||||
(item) => item.nameSingular === 'person',
|
||||
),
|
||||
},
|
||||
decorators: [
|
||||
|
||||
@@ -24,15 +24,13 @@ import {
|
||||
type RecordInlineCellProps = {
|
||||
readonly?: boolean;
|
||||
loading?: boolean;
|
||||
isCentered?: boolean;
|
||||
};
|
||||
|
||||
export const RecordInlineCell = ({
|
||||
readonly,
|
||||
loading,
|
||||
isCentered,
|
||||
}: RecordInlineCellProps) => {
|
||||
const { fieldDefinition, recordId } = useContext(FieldContext);
|
||||
const { fieldDefinition, recordId, isCentered } = useContext(FieldContext);
|
||||
const buttonIcon = useGetButtonIcon();
|
||||
|
||||
const isFieldInputOnly = useIsFieldInputOnly();
|
||||
@@ -90,7 +88,7 @@ export const RecordInlineCell = ({
|
||||
label: fieldDefinition.label,
|
||||
labelWidth: fieldDefinition.labelWidth,
|
||||
showLabel: fieldDefinition.showLabel,
|
||||
isCentered: isCentered,
|
||||
isCentered,
|
||||
editModeContent: (
|
||||
<FieldInput
|
||||
recordFieldInputdId={getRecordFieldInputId(
|
||||
|
||||
@@ -42,6 +42,7 @@ const StyledValueContainer = styled.div`
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
min-width: 0;
|
||||
position: relative;
|
||||
`;
|
||||
|
||||
const StyledLabelContainer = styled.div<{ width?: number }>`
|
||||
@@ -79,7 +80,6 @@ export type RecordInlineCellContainerProps = {
|
||||
isDisplayModeFixHeight?: boolean;
|
||||
disableHoverEffect?: boolean;
|
||||
loading?: boolean;
|
||||
isCentered?: boolean;
|
||||
};
|
||||
|
||||
export const RecordInlineCellContainer = () => {
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import { RecordInlineCellContext } from '@/object-record/record-inline-cell/components/RecordInlineCellContext';
|
||||
import styled from '@emotion/styled';
|
||||
import { autoUpdate, flip, offset, useFloating } from '@floating-ui/react';
|
||||
import { useContext } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
|
||||
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
|
||||
|
||||
const StyledInlineCellEditModeContainer = styled.div`
|
||||
align-items: center;
|
||||
|
||||
display: flex;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
height: 24px;
|
||||
|
||||
margin-left: -${({ theme }) => theme.spacing(1)};
|
||||
`;
|
||||
|
||||
const StyledInlineCellInput = styled.div`
|
||||
@@ -34,21 +33,21 @@ type RecordInlineCellEditModeProps = {
|
||||
export const RecordInlineCellEditMode = ({
|
||||
children,
|
||||
}: RecordInlineCellEditModeProps) => {
|
||||
const { isCentered } = useContext(FieldContext);
|
||||
const { isCentered } = useContext(RecordInlineCellContext);
|
||||
|
||||
const { refs, floatingStyles } = useFloating({
|
||||
placement: isCentered ? undefined : 'right-start',
|
||||
placement: isCentered ? 'bottom' : 'bottom-start',
|
||||
middleware: [
|
||||
flip(),
|
||||
offset(
|
||||
isCentered
|
||||
? {
|
||||
mainAxis: -32,
|
||||
crossAxis: 160,
|
||||
mainAxis: -26,
|
||||
crossAxis: 0,
|
||||
}
|
||||
: {
|
||||
mainAxis: -28,
|
||||
crossAxis: -4,
|
||||
mainAxis: -4,
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -202,10 +202,10 @@ export const RecordShowContainer = ({
|
||||
},
|
||||
useUpdateRecord: useUpdateOneObjectRecordMutation,
|
||||
hotkeyScope: InlineCellHotkeyScope.InlineCell,
|
||||
isCentered: true,
|
||||
isCentered: !isMobile,
|
||||
}}
|
||||
>
|
||||
<RecordInlineCell readonly={isReadOnly} isCentered={true} />
|
||||
<RecordInlineCell readonly={isReadOnly} />
|
||||
</FieldContext.Provider>
|
||||
}
|
||||
avatarType={recordIdentifier?.avatarType ?? 'rounded'}
|
||||
|
||||
@@ -50,7 +50,7 @@ const StyledTableHead = styled.thead<{
|
||||
clip-path: inset(0px -4px 0px 0px);
|
||||
}
|
||||
@media (max-width: ${MOBILE_VIEWPORT}px) {
|
||||
width: 35px;
|
||||
width: 30px;
|
||||
max-width: 35px;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user