Skip to content

Commit

Permalink
simplify getHeaderCellStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
nstepien committed Aug 23, 2023
1 parent fc5af65 commit 253c414
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/utils/styleUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,22 @@ export function getHeaderCellStyle<R, SR>(
rowIdx: number,
rowSpan: number
): React.CSSProperties {
const gridRowEnd = rowIdx + 1;
const paddingBlockStart = `calc(${rowSpan - 1} * var(--rdg-header-row-height))`;

if (column.parent === undefined) {
return {
insetBlockStart: 0,
gridRowStart: 1,
gridRowEnd: rowIdx + 1,
gridRowEnd,
paddingBlockStart
};
}

return {
insetBlockStart: `calc(${rowIdx - rowSpan} * var(--rdg-header-row-height))`,
gridRowStart: rowIdx - rowSpan + 1,
gridRowEnd: rowIdx + 1,
gridRowStart: gridRowEnd - rowSpan,
gridRowEnd,
paddingBlockStart
};
}
Expand Down

0 comments on commit 253c414

Please sign in to comment.