Skip to content

Commit b81678f

Browse files
authored
feat: shared notification theme variants (#11118)
* feat: shared notification theme variants * fix theme attribute selectors * add aura dark screenshots
1 parent 9948fc6 commit b81678f

File tree

22 files changed

+54
-11
lines changed

22 files changed

+54
-11
lines changed

packages/aura/src/color.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ vaadin-tab,
215215
--aura-accent-color: light-dark(var(--aura-accent-color-light), var(--aura-accent-color-dark));
216216
}
217217

218-
:is(#id, .aura-accent-green, .v-success) {
218+
:is(#id, [theme~='success'], .aura-accent-green, .v-success) {
219219
--aura-accent-color-light: var(--aura-green);
220220
--aura-accent-color-dark: var(--aura-green);
221221
--aura-accent-color: light-dark(var(--aura-accent-color-light), var(--aura-accent-color-dark));
222222
}
223223

224-
:is(#id, .aura-accent-yellow, .v-warning) {
224+
:is(#id, [theme~='warning'], .aura-accent-yellow, .v-warning) {
225225
--aura-accent-color-light: var(--aura-yellow);
226226
--aura-accent-color-dark: var(--aura-yellow);
227227
--aura-accent-color: light-dark(var(--aura-accent-color-light), var(--aura-accent-color-dark));
@@ -239,7 +239,7 @@ vaadin-tab,
239239
--aura-accent-color: light-dark(var(--aura-accent-color-light), var(--aura-accent-color-dark));
240240
}
241241

242-
:is(#id, .aura-accent-blue, .v-info) {
242+
:is(#id, [theme~='info'], .aura-accent-blue, .v-info) {
243243
--aura-accent-color-light: var(--aura-blue);
244244
--aura-accent-color-dark: var(--aura-blue);
245245
--aura-accent-color: light-dark(var(--aura-accent-color-light), var(--aura-accent-color-dark));

packages/aura/src/components/notification.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ vaadin-notification-card:is(
2929
.v-info,
3030
.v-success,
3131
.v-warning,
32-
.v-error
32+
.v-error,
33+
[theme~='info'],
34+
[theme~='success'],
35+
[theme~='warning'],
36+
[theme~='error']
3337
)::part(overlay) {
3438
--vaadin-notification-background: var(--aura-accent-surface);
3539
--vaadin-icon-color: var(--aura-accent-text-color);

packages/notification/test/visual/aura/notification.test.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,42 @@ describe('notification', () => {
3737
});
3838
});
3939
});
40+
41+
describe('variants', () => {
42+
let element;
43+
44+
beforeEach(() => {
45+
element = fixtureSync('<vaadin-notification duration="0"></vaadin-notification>');
46+
element.renderer = (root) => {
47+
root.textContent = 'Notification';
48+
};
49+
});
50+
51+
afterEach(() => {
52+
element.opened = false;
53+
});
54+
55+
describe('class', () => {
56+
['v-info', 'v-warning', 'v-error', 'v-success'].forEach((variant) => {
57+
it(variant, async () => {
58+
element.overlayClass = variant;
59+
element.opened = true;
60+
await nextRender();
61+
const notification = document.querySelector('vaadin-notification-card');
62+
await visualDiff(notification, `class-${variant}`);
63+
});
64+
});
65+
});
66+
67+
describe('theme', () => {
68+
['info', 'warning', 'error', 'success'].forEach((variant) => {
69+
it(variant, async () => {
70+
element.setAttribute('theme', variant);
71+
element.opened = true;
72+
await nextRender();
73+
const notification = document.querySelector('vaadin-notification-card');
74+
await visualDiff(notification, `theme-${variant}`);
75+
});
76+
});
77+
});
78+
});
2.4 KB
Loading
2.41 KB
Loading
2.42 KB
Loading
2.42 KB
Loading
2.4 KB
Loading
2.41 KB
Loading
2.42 KB
Loading

0 commit comments

Comments
 (0)