Fix: Selected Line Not Fully Highlighted in Blue (#5966)

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 <bordeau.lucas@gmail.com>
This commit is contained in:
Aakarshan Thapa
2024-06-21 09:49:47 -04:00
committed by GitHub
parent 51e3454d50
commit 35b9b29f20
4 changed files with 42 additions and 7 deletions

View File

@ -16,7 +16,6 @@ const StyledContainer = styled.div`
height: 32px; height: 32px;
justify-content: center; justify-content: center;
background-color: ${({ theme }) => theme.background.primary};
`; `;
export const CheckboxCell = () => { export const CheckboxCell = () => {

View File

@ -76,6 +76,7 @@ export const RecordTableHeader = ({
width: 30, width: 30,
minWidth: 30, minWidth: 30,
maxWidth: 30, maxWidth: 30,
borderRight: 'transparent',
}} }}
> >
<SelectAllCheckbox /> <SelectAllCheckbox />

View File

@ -23,9 +23,17 @@ type RecordTableRowProps = {
isPendingRow?: boolean; isPendingRow?: boolean;
}; };
export const StyledTd = styled.td` export const StyledTd = styled.td<{ isSelected?: boolean }>`
background: ${({ theme }) => theme.background.primary};
position: relative; position: relative;
user-select: none; user-select: none;
${({ isSelected, theme }) =>
isSelected &&
`
background: ${theme.accent.quaternary};
`}
`; `;
export const StyledTr = styled.tr<{ isDragging: boolean }>` export const StyledTr = styled.tr<{ isDragging: boolean }>`
@ -33,7 +41,6 @@ export const StyledTr = styled.tr<{ isDragging: boolean }>`
transition: border-left-color 0.2s ease-in-out; transition: border-left-color 0.2s ease-in-out;
td:nth-of-type(-n + 2) { td:nth-of-type(-n + 2) {
background-color: ${({ theme }) => theme.background.primary};
border-right-color: ${({ theme }) => theme.background.primary}; border-right-color: ${({ theme }) => theme.background.primary};
} }
@ -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 = ({ export const RecordTableRow = ({
recordId, recordId,
rowIndex, rowIndex,
@ -127,9 +148,12 @@ export const RecordTableRow = ({
> >
<GripCell isDragging={draggableSnapshot.isDragging} /> <GripCell isDragging={draggableSnapshot.isDragging} />
</StyledTd> </StyledTd>
<StyledTd> <SelectableStyledTd
isSelected={currentRowSelected}
style={{ borderRight: 'transparent' }}
>
{!draggableSnapshot.isDragging && <CheckboxCell />} {!draggableSnapshot.isDragging && <CheckboxCell />}
</StyledTd> </SelectableStyledTd>
{inView || draggableSnapshot.isDragging {inView || draggableSnapshot.isDragging
? visibleTableColumns.map((column, columnIndex) => ( ? visibleTableColumns.map((column, columnIndex) => (
<RecordTableCellContext.Provider <RecordTableCellContext.Provider
@ -145,9 +169,12 @@ export const RecordTableRow = ({
</RecordTableCellContext.Provider> </RecordTableCellContext.Provider>
)) ))
: visibleTableColumns.map((column) => ( : visibleTableColumns.map((column) => (
<StyledTd key={column.fieldMetadataId}></StyledTd> <StyledTd
isSelected={currentRowSelected}
key={column.fieldMetadataId}
></StyledTd>
))} ))}
<StyledTd /> <SelectableStyledTd isSelected={currentRowSelected} />
</StyledTr> </StyledTr>
)} )}
</Draggable> </Draggable>

View File

@ -1,3 +1,11 @@
/*
!! DEPRECATED !!
Please do not use those variables anymore. They are deprecated and will be removed soon.
*/
:root { :root {
--twentycrm-spacing-multiplicator: 4; --twentycrm-spacing-multiplicator: 4;
--twentycrm-border-radius-sm: 4px; --twentycrm-border-radius-sm: 4px;