Skip to content

Commit

Permalink
fix(table): add zebra color to sticky column (#984)
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and GitHub Enterprise committed Jul 19, 2023
1 parent 3f130cf commit f5d071a
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion projects/ng-aquila/src/shared-styles/theming/tokens.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ $nx-theme: (
table-header-cell-background-color: transparent,
table-row-background-color: transparent,
// Sticky column can never be transparent
table-sticky-column-background-color: ui-03,
table-sticky-column-background-color: ui-background,
// Selectable table
selectable-table-row-hover-background-color: ui-02,
selectable-table-row-active-background-color: ui-02,
Expand Down
48 changes: 48 additions & 0 deletions projects/ng-aquila/src/table/table.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -330,5 +330,53 @@ $sticky-shadow-size: nx-spacer(3xs);
box-shadow: -$sticky-shadow-size 0 $sticky-shadow-offset (-$sticky-shadow-size) v(shadow-small-color) inset;
}
}

// add the zebra color to the sticky column
::ng-deep .nx-table-row:nth-child(2n) & {
:host(.nx-table--sticky-first.nx-table--zebra) &:first-child,
:host(.nx-table--sticky-last.nx-table--zebra) &:last-child {
background: v(zebra-table-even-row-background-color);
}
}

// add the selected row color to the sticky column
::ng-deep .nx-table-row--selectable.is-selected & {
:host(.nx-table--sticky-first) &:first-child,
:host(.nx-table--sticky-last) &:last-child {
background: v(zebra-table-row-selected-background-color);
}
}

// add hover to the sticky column of non selected rows
::ng-deep .nx-table-row--selectable:not(.is-selected):hover & {
:host(.nx-table--sticky-first) &:first-child,
:host(.nx-table--sticky-last) &:last-child {
background: v(selectable-table-row-hover-background-color);
}
}

// add hover to the sticky column of non selected zebra rows
::ng-deep .nx-table-row--selectable:not(.is-selected):hover & {
:host(.nx-table--sticky-first.nx-table--zebra) &:first-child,
:host(.nx-table--sticky-last.nx-table--zebra) &:last-child {
background: v(zebra-table-row-hover-background-color);
}
}

// add hover to the sticky column of selected rows
::ng-deep .nx-table-row--selectable.is-selected:hover & {
:host(.nx-table--sticky-first) &:first-child,
:host(.nx-table--sticky-last) &:last-child {
background: v(zebra-table-even-row-background-color);
}
}

// add active to the sticky column of non selected rows
::ng-deep .nx-table-row--selectable:not(.is-selected):active & {
:host(.nx-table--sticky-first.nx-table--zebra) &:first-child,
:host(.nx-table--sticky-last.nx-table--zebra) &:last-child {
background: v(zebra-table-row-active-background-color);
}
}
}
}

0 comments on commit f5d071a

Please sign in to comment.