Skip to content

Commit

Permalink
Fix: Selected Line Not Fully Highlighted in Blue (#5966)
Browse files Browse the repository at this point in the history
Fixes: #5942

<img width="1517" alt="Screenshot 2024-06-19 at 5 07 35 PM"
src="https://github.com/twentyhq/twenty/assets/63531478/c88a98e9-7ce3-43fe-a496-1a5dfe796b81">

---------

Co-authored-by: Lucas Bordeau <[email protected]>
  • Loading branch information
akarsanth and lucasbordeau authored Jun 21, 2024
1 parent 51e3454 commit 35b9b29
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const StyledContainer = styled.div`
height: 32px;
justify-content: center;
background-color: ${({ theme }) => theme.background.primary};
`;

export const CheckboxCell = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const RecordTableHeader = ({
width: 30,
minWidth: 30,
maxWidth: 30,
borderRight: 'transparent',
}}
>
<SelectAllCheckbox />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,24 @@ type RecordTableRowProps = {
isPendingRow?: boolean;
};

export const StyledTd = styled.td`
export const StyledTd = styled.td<{ isSelected?: boolean }>`
background: ${({ theme }) => theme.background.primary};
position: relative;
user-select: none;
${({ isSelected, theme }) =>
isSelected &&
`
background: ${theme.accent.quaternary};
`}
`;

export const StyledTr = styled.tr<{ isDragging: boolean }>`
border: 1px solid transparent;
transition: border-left-color 0.2s ease-in-out;
td:nth-of-type(-n + 2) {
background-color: ${({ theme }) => theme.background.primary};
border-right-color: ${({ theme }) => theme.background.primary};
}
Expand All @@ -58,6 +65,20 @@ export const StyledTr = styled.tr<{ isDragging: boolean }>`
`}
`;

const SelectableStyledTd = ({
isSelected,
children,
style,
}: {
isSelected: boolean;
children?: React.ReactNode;
style?: React.CSSProperties;
}) => (
<StyledTd isSelected={isSelected} style={style}>
{children}
</StyledTd>
);

export const RecordTableRow = ({
recordId,
rowIndex,
Expand Down Expand Up @@ -127,9 +148,12 @@ export const RecordTableRow = ({
>
<GripCell isDragging={draggableSnapshot.isDragging} />
</StyledTd>
<StyledTd>
<SelectableStyledTd
isSelected={currentRowSelected}
style={{ borderRight: 'transparent' }}
>
{!draggableSnapshot.isDragging && <CheckboxCell />}
</StyledTd>
</SelectableStyledTd>
{inView || draggableSnapshot.isDragging
? visibleTableColumns.map((column, columnIndex) => (
<RecordTableCellContext.Provider
Expand All @@ -145,9 +169,12 @@ export const RecordTableRow = ({
</RecordTableCellContext.Provider>
))
: visibleTableColumns.map((column) => (
<StyledTd key={column.fieldMetadataId}></StyledTd>
<StyledTd
isSelected={currentRowSelected}
key={column.fieldMetadataId}
></StyledTd>
))}
<StyledTd />
<SelectableStyledTd isSelected={currentRowSelected} />
</StyledTr>
)}
</Draggable>
Expand Down
8 changes: 8 additions & 0 deletions packages/twenty-ui/src/theme/provider/theme.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
!! DEPRECATED !!
Please do not use those variables anymore. They are deprecated and will be removed soon.
*/

:root {
--twentycrm-spacing-multiplicator: 4;
--twentycrm-border-radius-sm: 4px;
Expand Down

0 comments on commit 35b9b29

Please sign in to comment.