Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Selected Line Not Fully Highlighted in Blue #5966

Merged
merged 6 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading