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

refactor: style specific sticky columns in carbon row #6351

Merged
merged 8 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -3647,15 +3647,21 @@ p.c4p--about-modal__copyright-text:first-child {
/* stylelint-disable-next-line declaration-no-important */
color: var(--cds-link-primary-hover, #0043ce) !important;
}
.c4p--datagrid__grid-container .c4p--datagrid__carbon-row td {
.c4p--datagrid__grid-container .c4p--datagrid__carbon-row .c4p--datagrid__left-sticky-column-cell,
.c4p--datagrid__grid-container .c4p--datagrid__carbon-row .c4p--datagrid__right-sticky-column-cell,
.c4p--datagrid__grid-container .c4p--datagrid__carbon-row .c4p--datagrid__checkbox-cell-sticky-left {
/* stylelint-disable-next-line declaration-no-important */
background-color: var(--cds-layer-01, #f4f4f4);
}
.c4p--datagrid__grid-container .c4p--datagrid__carbon-row:hover td {
.c4p--datagrid__grid-container .c4p--datagrid__carbon-row:hover .c4p--datagrid__left-sticky-column-cell,
.c4p--datagrid__grid-container .c4p--datagrid__carbon-row:hover .c4p--datagrid__right-sticky-column-cell,
.c4p--datagrid__grid-container .c4p--datagrid__carbon-row:hover .c4p--datagrid__checkbox-cell-sticky-left {
/* stylelint-disable-next-line declaration-no-important */
background-color: var(--cds-layer-hover-01, #e8e8e8);
}
.c4p--datagrid__grid-container .cds--data-table--selected td {
.c4p--datagrid__grid-container .cds--data-table--selected .c4p--datagrid__left-sticky-column-cell,
.c4p--datagrid__grid-container .cds--data-table--selected .c4p--datagrid__right-sticky-column-cell,
.c4p--datagrid__grid-container .cds--data-table--selected .c4p--datagrid__checkbox-cell-sticky-left {
/* stylelint-disable-next-line declaration-no-important */
background-color: var(--cds-layer-selected-01, #e0e0e0);
}
Expand Down Expand Up @@ -3740,7 +3746,7 @@ p.c4p--about-modal__copyright-text:first-child {
}

.c4p--datagrid__resizableColumn:hover {
background-color: var(--cds-background-selected-hover, rgba(141, 141, 141, 0.32));
background-color: var(--cds-layer-selected-hover);
}
.c4p--datagrid__resizableColumn:hover .c4p--datagrid__resizer {
border-right: 0.125rem solid var(--cds-border-strong-01, #8d8d8d);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

.#{$block-class}__head-select-all.#{$block-class}__checkbox-cell.#{$block-class}__checkbox-cell-sticky-left {
position: sticky;
z-index: 1;
z-index: 10;
left: 0;
}
}
Expand Down Expand Up @@ -413,17 +413,27 @@
}
}

.#{$block-class}__carbon-row td {
.#{$block-class}__carbon-row .#{$block-class}__left-sticky-column-cell,
.#{$block-class}__carbon-row .#{$block-class}__right-sticky-column-cell,
.#{$block-class}__carbon-row .#{$block-class}__checkbox-cell-sticky-left {
/* stylelint-disable-next-line declaration-no-important */
background-color: $layer-01;
}

.#{$block-class}__carbon-row:hover td {
.#{$block-class}__carbon-row:hover .#{$block-class}__left-sticky-column-cell,
.#{$block-class}__carbon-row:hover .#{$block-class}__right-sticky-column-cell,
.#{$block-class}__carbon-row:hover
.#{$block-class}__checkbox-cell-sticky-left {
/* stylelint-disable-next-line declaration-no-important */
background-color: $layer-hover-01;
}

.#{c4p-settings.$carbon-prefix}--data-table--selected td {
.#{c4p-settings.$carbon-prefix}--data-table--selected
.#{$block-class}__left-sticky-column-cell,
.#{c4p-settings.$carbon-prefix}--data-table--selected
.#{$block-class}__right-sticky-column-cell,
.#{c4p-settings.$carbon-prefix}--data-table--selected
.#{$block-class}__checkbox-cell-sticky-left {
/* stylelint-disable-next-line declaration-no-important */
background-color: $layer-selected-01;
}
Expand Down Expand Up @@ -522,7 +532,7 @@
}

.#{$block-class}__resizableColumn:hover {
background-color: $background-selected-hover;
background-color: $layer-selected-hover;

.#{$block-class}__resizer {
border-right: $spacing-01 solid $border-strong-01;
Expand Down Expand Up @@ -562,7 +572,7 @@

&.#{$block-class}__select-all-sticky-left {
position: sticky;
z-index: 1;
z-index: 10;
left: 0;
background-color: $layer-accent-01;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
.#{variables.$block-class}__left-sticky-column-header {
/* stylelint-disable-next-line declaration-no-important */
position: sticky !important;
z-index: 1;
z-index: 10;
left: 0;
border-right: 1px solid $border-subtle;
}
Expand Down Expand Up @@ -67,6 +67,6 @@

.#{variables.$block-class}__select-all-toggle-on.#{variables.$block-class}__select-all-sticky-left {
position: sticky;
z-index: 1;
z-index: 10;
left: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export const SelectableRow = () => {

export const Header = () => {
const [data] = useState(makeData(10));
const columns = getColumns(data);
const columns = React.useMemo(() => getColumns(data), []);
const emptyStateTitle = 'Empty state title';
const emptyStateDescription = 'Description explaining why the table is empty';
const datagridState = useDatagrid({
Expand Down
Loading