Skip to content

Commit

Permalink
5236 expandable list leave options when editing (twentyhq#5890)
Browse files Browse the repository at this point in the history
  • Loading branch information
martmull authored Jun 17, 2024
1 parent d99b9d1 commit d8034b1
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import { ObjectRecordForSelect } from '@/object-record/relation-picker/hooks/use
import { prefillRecord } from '@/object-record/utils/prefillRecord';

const StyledSelectContainer = styled.div`
left: 0px;
position: absolute;
top: -8px;
left: 0;
top: 0;
`;

type ActivityTargetInlineCellEditModeProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const StyledLabelAndIconContainer = styled.div`

const StyledValueContainer = styled.div`
display: flex;
width: 100%;
flex-grow: 1;
min-width: 0;
`;

const StyledLabelContainer = styled.div<{ width?: number }>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,35 +72,40 @@ export const RecordInlineCellValue = ({
return <RecordInlineCellSkeletonLoader />;
}

return !readonly && isInlineCellInEditMode ? (
<RecordInlineCellEditMode>{editModeContent}</RecordInlineCellEditMode>
) : editModeContentOnly ? (
<StyledClickableContainer readonly={readonly}>
<RecordInlineCellDisplayMode
disableHoverEffect={disableHoverEffect}
isDisplayModeContentEmpty={isDisplayModeContentEmpty}
isDisplayModeFixHeight={isDisplayModeFixHeight}
isHovered={isFocused}
emptyPlaceholder={showLabel ? 'Empty' : label}
>
{editModeContent}
</RecordInlineCellDisplayMode>
</StyledClickableContainer>
) : (
<StyledClickableContainer
readonly={readonly}
onClick={handleDisplayModeClick}
>
<RecordInlineCellDisplayMode
disableHoverEffect={disableHoverEffect}
isDisplayModeContentEmpty={isDisplayModeContentEmpty}
isDisplayModeFixHeight={isDisplayModeFixHeight}
isHovered={isFocused}
emptyPlaceholder={showLabel ? 'Empty' : label}
>
{displayModeContent}
</RecordInlineCellDisplayMode>
{showEditButton && <RecordInlineCellButton Icon={buttonIcon} />}
</StyledClickableContainer>
return (
<>
{!readonly && isInlineCellInEditMode && (
<RecordInlineCellEditMode>{editModeContent}</RecordInlineCellEditMode>
)}
{editModeContentOnly ? (
<StyledClickableContainer readonly={readonly}>
<RecordInlineCellDisplayMode
disableHoverEffect={disableHoverEffect}
isDisplayModeContentEmpty={isDisplayModeContentEmpty}
isDisplayModeFixHeight={isDisplayModeFixHeight}
isHovered={isFocused}
emptyPlaceholder={showLabel ? 'Empty' : label}
>
{editModeContent}
</RecordInlineCellDisplayMode>
</StyledClickableContainer>
) : (
<StyledClickableContainer
readonly={readonly}
onClick={handleDisplayModeClick}
>
<RecordInlineCellDisplayMode
disableHoverEffect={disableHoverEffect}
isDisplayModeContentEmpty={isDisplayModeContentEmpty}
isDisplayModeFixHeight={isDisplayModeFixHeight}
isHovered={isFocused}
emptyPlaceholder={showLabel ? 'Empty' : label}
>
{displayModeContent}
</RecordInlineCellDisplayMode>
{showEditButton && <RecordInlineCellButton Icon={buttonIcon} />}
</StyledClickableContainer>
)}
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,14 @@ export const RecordTableCellContainer = ({
[styles.cellBaseContainerSoftFocus]: hasSoftFocus,
})}
>
{isInEditMode ? (
{isInEditMode && (
<RecordTableCellEditMode>{editModeContent}</RecordTableCellEditMode>
) : hasSoftFocus ? (
<>
<RecordTableCellSoftFocusMode
editModeContent={editModeContent}
nonEditModeContent={nonEditModeContent}
/>
</>
)}
{hasSoftFocus ? (
<RecordTableCellSoftFocusMode
editModeContent={editModeContent}
nonEditModeContent={nonEditModeContent}
/>
) : (
<RecordTableCellDisplayMode>
{nonEditModeContent}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled from '@emotion/styled';
import { autoUpdate, flip, offset, useFloating } from '@floating-ui/react';

const StyledEditableCellEditModeContainer = styled.div<RecordTableCellEditModeProps>`
position: absolute;
align-items: center;
display: flex;
min-width: 200px;
Expand Down

0 comments on commit d8034b1

Please sign in to comment.