Skip to content

Commit 4a3bbc1

Browse files
DitwanPbenelan
authored andcommitted
feat(notice): add token for close icon and title text color (#11938)
**Related Issue:** #11790 ## Summary The issue was initially to fix the fact that the text title color was being changed along with the `--calcite-notice-close-text-color-hover` token. In addition I'm proposing a name change (deprecation) for the following tokens: `--calcite-notice-close-text-color` `--calcite-notice-close-text-color-hover` to: `--calcite-notice-close-icon-color` `--calcite-notice-close-icon-color-hover` Also a new token would be added to target the title text color: `--calcite-notice-title-text-color` deprecate(notice): deprecate notice close text color tokens
1 parent a1798ee commit 4a3bbc1

File tree

4 files changed

+38
-9
lines changed

4 files changed

+38
-9
lines changed

packages/calcite-components/src/components/notice/notice.e2e.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,20 @@ describe("calcite-notice", () => {
145145
shadowSelector: `.${CSS.container}`,
146146
targetProp: "backgroundColor",
147147
},
148-
"--calcite-notice-close-text-color": {
148+
"--calcite-notice-close-icon-color": {
149149
shadowSelector: `.${CSS.close}`,
150150
targetProp: "color",
151151
},
152-
"--calcite-notice-close-text-color-hover": [
152+
"--calcite-notice-close-icon-color-hover": [
153153
{
154154
shadowSelector: `.${CSS.close}`,
155155
targetProp: "color",
156-
state: "focus",
156+
state: { focus: { attribute: "class", value: CSS.close } },
157157
},
158158
{
159159
shadowSelector: `.${CSS.close}`,
160160
targetProp: "color",
161-
state: "hover",
161+
state: { hover: { attribute: "class", value: CSS.close } },
162162
},
163163
],
164164
"--calcite-notice-close-background-color-focus": [

packages/calcite-components/src/components/notice/notice.scss

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66
* @prop --calcite-notice-background-color: Specifies the component's background color.
77
* @prop --calcite-notice-close-background-color-focus: Specifies the component's background color when focused.
88
* @prop --calcite-notice-close-background-color-press: Specifies the component's background color when active.
9-
* @prop --calcite-notice-close-text-color-hover: Specifies the background color of the component's close button when hovered.
10-
* @prop --calcite-notice-close-text-color: Specifies the text color of the component's close button.
9+
* @prop --calcite-notice-close-icon-color-hover: Specifies the background color of the component's close button when hovered.
10+
* @prop --calcite-notice-close-icon-color: Specifies the text color of the component's close button.
11+
* @prop --calcite-notice-title-text-color: Specifies the component's title text color.
1112
* @prop --calcite-notice-content-text-color: Specifies the component's content text color.
1213
* @prop --calcite-notice-width: [Deprecated] Specifies the component's width.
14+
* @prop --calcite-notice-close-text-color-hover: [Deprecated] Use `--calcite-notice-close-icon-color-hover`. Specifies the background color of the component's close button when hovered.
15+
* @prop --calcite-notice-close-text-color: [Deprecated] Use `--calcite-notice-close-icon-color`. Specifies the text color of the component's close button.
1316
*/
1417

1518
// scale variables
@@ -118,7 +121,7 @@
118121
@include slotted("title", "*", ".container") {
119122
@apply m-0 font-medium;
120123

121-
color: var(--calcite-notice-close-text-color-hover, var(--calcite-color-text-1));
124+
color: var(--calcite-notice-title-text-color, var(--calcite-color-text-1));
122125
}
123126

124127
@include slotted("message", "*", ".container") {
@@ -161,12 +164,12 @@
161164
@include notice-element-base;
162165
-webkit-appearance: none;
163166

164-
color: var(--calcite-notice-close-text-color, var(--calcite-color-text-3));
167+
color: var(--calcite-notice-close-icon-color, var(--calcite-color-text-3));
165168

166169
&:hover,
167170
&:focus {
168171
background-color: var(--calcite-notice-close-background-color-focus, var(--calcite-color-foreground-2));
169-
color: var(--calcite-notice-close-text-color-hover, var(--calcite-color-text-1));
172+
color: var(--calcite-notice-close-icon-color-hover, var(--calcite-color-text-1));
170173
}
171174

172175
&:active {

packages/calcite-components/src/custom-theme/notice.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ export const noticeTokens = {
66
calciteNoticeCloseBackgroundColorPress: "",
77
calciteNoticeCloseTextColorHover: "",
88
calciteNoticeCloseTextColor: "",
9+
calciteNoticeCloseIconColorHover: "",
10+
calciteNoticeCloseIconColor: "",
11+
calciteNoticeTitleTextColor: "",
912
calciteNoticeContentTextColor: "",
1013
};
1114

packages/calcite-components/src/demos/notice.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@
3131
margin: 60px 0;
3232
border-top: 1px solid var(--calcite-color-border-2);
3333
}
34+
35+
.themed {
36+
--calcite-notice-background-color: pink;
37+
--calcite-notice-close-background-color-focus: aquamarine;
38+
--calcite-notice-close-background-color-press: teal;
39+
--calcite-notice-close-icon-color-hover: red;
40+
--calcite-notice-close-icon-color: green;
41+
--calcite-notice-title-text-color: purple;
42+
--calcite-notice-content-text-color: yellow;
43+
}
3444
</style>
3545
<script src="./_assets/head.ts"></script>
3646
</head>
@@ -513,6 +523,19 @@ <h1 style="margin: 0 auto; text-align: center">Notice</h1>
513523
</calcite-notice>
514524
</div>
515525
</div>
526+
527+
<!-- themed -->
528+
<div class="parent">
529+
<div class="child right-aligned-text">Themed</div>
530+
531+
<div class="child themed">
532+
<calcite-notice icon scale="l" open closable>
533+
<div slot="title">Title lorem ispum</div>
534+
<div slot="message">Body lorem ispum</div>
535+
<calcite-link slot="link" title="my action">Link ispum </calcite-link>
536+
</calcite-notice>
537+
</div>
538+
</div>
516539
</demo-dom-swapper>
517540
</body>
518541
</html>

0 commit comments

Comments
 (0)