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(block): heading text color #11314

Merged
merged 4 commits into from
Jan 16, 2025
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
19 changes: 13 additions & 6 deletions packages/calcite-components/src/components/block/block.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,17 +459,24 @@ describe("calcite-block", () => {
{ shadowSelector: `.${CSS.iconStart}`, targetProp: "color" },
{ shadowSelector: `.${CSS.toggleIcon}`, targetProp: "color" },
],
"--calcite-block-text-color-hover": {
shadowSelector: `.${CSS.toggleIcon}`,
targetProp: "color",
state: "hover",
},
"--calcite-block-heading-text-color-press": [
{
shadowSelector: `.${CSS.toggleIcon}`,
targetProp: "color",
state: "hover",
},
{
shadowSelector: `.${CSS.heading}`,
targetProp: "color",
state: { press: { attribute: "class", value: CSS.heading } },
},
],
},
);
});
describe("closed", () => {
themed(html`<calcite-block heading="heading"></calcite-block>`, {
"--calcite-block-header-text-color": { shadowSelector: `.${CSS.heading}`, targetProp: "color" },
"--calcite-block-heading-text-color": { shadowSelector: `.${CSS.heading}`, targetProp: "color" },
});
});
});
Expand Down
10 changes: 5 additions & 5 deletions packages/calcite-components/src/components/block/block.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
* @prop --calcite-block-border-color: Specifies the component's border color.
* @prop --calcite-block-header-background-color: Specifies the component's `heading` background color.
* @prop --calcite-block-header-background-color-hover: Specifies the component's `heading` background color when hovered.
* @prop --calcite-block-header-text-color: Specifies the component's `heading` text color.
* @prop --calcite-block-heading-text-color: Specifies the component's `heading` text color.
* @prop --calcite-block-heading-text-color-press: When the component is `open`, specifies the `heading` text color.
* @prop --calcite-block-padding: [Deprecated] Specifies the padding of the component's `default` slot.
* @prop --calcite-block-text-color: Specifies the component's text color.
* @prop --calcite-block-text-color-hover: Specifies the component's text color when hovered.
*/

:host {
Expand Down Expand Up @@ -119,7 +119,7 @@ calcite-handle {
ease-in-out
p-0;

color: var(--calcite-block-header-text-color, var(--calcite-color-text-2));
color: var(--calcite-block-heading-text-color, var(--calcite-color-text-2));
}

.description {
Expand Down Expand Up @@ -173,7 +173,7 @@ calcite-handle {
}

.toggle:hover .toggle-icon {
color: var(--calcite-block-text-color-hover, var(--calcite-color-text-1));
color: var(--calcite-block-heading-text-color-press, var(--calcite-color-text-1));
}

.container {
Expand Down Expand Up @@ -209,7 +209,7 @@ calcite-action-menu {
@apply my-2;

.header .title .heading {
color: var(--calcite-block-text-color-hover, var(--calcite-color-text-1));
color: var(--calcite-block-heading-text-color-press, var(--calcite-color-text-1));
}
}

Expand Down
9 changes: 4 additions & 5 deletions packages/calcite-components/src/custom-theme/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import { html } from "../../support/formatting";

export const blockTokens = {
calciteBlockBorderColor: "",
calciteBlockContentStartColor: "",
calciteBlockHeaderBackgroundColor: "",
calciteBlockHeaderDescriptionColor: "",
calciteBlockHeaderIconColor: "",
calciteBlockIconColorEnd: "",
calciteBlockIconColorStart: "",
calciteBlockHeaderBackgroundColorHover: "",
calciteBlockTextColor: "",
calciteBlockHeadingTextColor: "",
calciteBlockHeadingTextColorPress: "",
};

export const block = html` <calcite-block
Expand Down
Loading