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(table-cell): Fix background css variable #8439

Merged
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 @@ -4,12 +4,10 @@
* These properties can be overridden using the component's tag as selector.
*
* @prop --calcite-table-cell-background: Specifies the background color of the component.
* @prop --calcite-table-cell-border-color: Specifies the border color of the component.
*/

:host {
--calcite-internal-table-cell-background-internal: var(--calcite-table-cell-background, transparent);
--calcite-internal-table-cell-border-color-internal: var(--calcite-table-cell-border-color, transparent);
--calcite-internal-table-cell-background: var(--calcite-table-cell-background, transparent);
@apply contents;
}

Expand Down Expand Up @@ -58,8 +56,7 @@ td {
}

.selected-cell:not(.number-cell):not(.footer-cell) {
--calcite-table-cell-background: var(--calcite-color-foreground-current);
background: var(--calcite-color-foreground-current);
--calcite-internal-table-cell-background: var(--calcite-color-foreground-current);
}

.selection-cell.selected-cell {
Expand Down
28 changes: 28 additions & 0 deletions packages/calcite-components/src/components/table/table.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,34 @@ export const localized_TestOnly = (): string => html`<calcite-table
</calcite-table-row>
</calcite-table>`;

export const tableCellCssBackgroundVariable_TestOnly = (): string =>
html`<calcite-table zebra caption="Simple-zebra table" dir="rtl" selection-mode="multiple">
<calcite-table-row slot="table-header">
<calcite-table-header heading="Heading" description="Description"></calcite-table-header>
<calcite-table-header heading="Heading" description="Description"></calcite-table-header>
<calcite-table-header heading="Heading" description="Description"></calcite-table-header>
<calcite-table-header heading="Heading" description="Description"></calcite-table-header>
</calcite-table-row>
<calcite-table-row>
<calcite-table-cell style="--calcite-table-cell-background: rgba(20, 200, 50, 0.15)">cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
</calcite-table-row>
<calcite-table-row>
<calcite-table-cell style="--calcite-table-cell-background: rgba(200, 50, 20, 0.15)">cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell style="--calcite-table-cell-background: rgba(20, 200, 50, 0.15)">cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
</calcite-table-row>
<calcite-table-row>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
<calcite-table-cell style="--calcite-table-cell-background: rgba(200, 50, 20, 0.15)">cell</calcite-table-cell>
<calcite-table-cell>cell</calcite-table-cell>
</calcite-table-row>
</calcite-table>`;

export const darkModeRTL_TestOnly = (): string =>
html`<calcite-table zebra caption="Simple-zebra table" dir="rtl">
<calcite-table-row slot="table-header">
Expand Down
Loading