Skip to content

Commit 831d845

Browse files
authored
fix(list): consume all css vars from schemas (#1538)
1 parent 726349c commit 831d845

File tree

9 files changed

+46
-58
lines changed

9 files changed

+46
-58
lines changed

src/components/list/list.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import IgcListHeaderComponent from './list-header.js';
66
import IgcListItemComponent from './list-item.js';
77
import { styles } from './themes/container.base.css.js';
88
import { all } from './themes/container.js';
9+
import { styles as shared } from './themes/shared/container/list.common.css.js';
910

1011
/**
1112
* Displays a collection of data items in a templatable list format.
@@ -17,7 +18,7 @@ import { all } from './themes/container.js';
1718
@themes(all)
1819
export default class IgcListComponent extends LitElement {
1920
public static readonly tagName = 'igc-list';
20-
public static override styles = styles;
21+
public static override styles = [styles, shared];
2122

2223
/* blazorSuppress */
2324
public static register() {
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
@use 'styles/common/component';
22
@use 'styles/utilities' as *;
3-
@use './light/themes' as *;
4-
5-
$theme: $material;
63

74
:host {
85
display: flex;
96
flex-flow: column nowrap;
107
font-family: var(--ig-font-family);
118
overflow: hidden auto;
129
height: auto;
13-
background: var-get($theme, 'background');
14-
border-radius: var-get($theme, 'border-radius');
1510
}

src/components/list/themes/container.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { styles as sharedLight } from './light/container/list.shared.css.js';
1717
import { styles as bootstrap } from './shared/container/list.bootstrap.css.js';
1818
import { styles as fluent } from './shared/container/list.fluent.css.js';
1919
import { styles as indigo } from './shared/container/list.indigo.css.js';
20-
import { styles as material } from './shared/container/list.material.css.js';
2120

2221
const light = {
2322
shared: css`
@@ -27,7 +26,7 @@ const light = {
2726
${bootstrap} ${bootstrapLight}
2827
`,
2928
material: css`
30-
${material} ${materialLight}
29+
${materialLight}
3130
`,
3231
fluent: css`
3332
${fluent} ${fluentLight}
@@ -45,7 +44,7 @@ const dark = {
4544
${bootstrap} ${bootstrapDark}
4645
`,
4746
material: css`
48-
${material} ${materialDark}
47+
${materialDark}
4948
`,
5049
fluent: css`
5150
${fluent} ${fluentDark}

src/components/list/themes/shared/container/list.bootstrap.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@ $theme: $bootstrap;
66
:host {
77
--component-size: var(--ig-size, #{var-get($theme, 'default-size')}) !important;
88

9-
background: var-get($theme, 'background');
10-
border: rem(1px) solid var-get($theme, 'border-color');
11-
border-radius: var-get($theme, 'border-radius');
9+
border: var-get($theme, 'border-width') solid var-get($theme, 'border-color');
1210
}

src/components/list/themes/shared/container/list.material.scss renamed to src/components/list/themes/shared/container/list.common.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
@use 'styles/utilities' as *;
22
@use '../../light/themes' as *;
33

4-
$theme: $material;
4+
$theme: $base;
55

66
:host {
77
--component-size: var(--ig-size, #{var-get($theme, 'default-size')}) !important;
8-
}
8+
9+
background: var-get($theme, 'background');
10+
border-radius: var-get($theme, 'border-radius');
11+
}
Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
11
@use 'styles/utilities' as *;
2-
@use '../../light/themes' as *;
3-
4-
$theme: $bootstrap;
5-
6-
:host {
7-
border-bottom: rem(1px) solid var-get($theme, 'border-color');
8-
}
9-
10-
:host(:last-of-type) {
11-
border-bottom: none;
12-
}
132

143
[part='title'] {
154
@include type-style('body-1');
165
}
17-
18-
[part='subtitle'] {
19-
@include type-style('body-2');
20-
}

src/components/list/themes/shared/item/list-item.common.scss

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,33 @@ $theme: $material;
77
border-radius: var-get($theme, 'item-border-radius');
88
color: var-get($theme, 'item-text-color');
99
background: var-get($theme, 'item-background');
10+
border-bottom: var-get($theme, 'border-width') solid var-get($theme, 'border-color');
1011
}
1112

12-
::slotted(igc-icon) {
13+
:host(:last-of-type) {
14+
border-bottom: none;
15+
}
16+
17+
[part='title'] {
18+
color: var-get($theme, 'item-title-color');
19+
}
20+
21+
[part='subtitle'] {
22+
color: var-get($theme, 'item-subtitle-color');
23+
}
24+
25+
[part='start'] {
26+
color: var-get($theme, 'item-thumbnail-color');
27+
}
28+
29+
[part='end'] {
1330
color: var-get($theme, 'item-action-color');
1431
}
1532

1633
:host(:hover),
1734
:host(:focus-within) {
1835
background: var-get($theme, 'item-background-hover');
19-
20-
::slotted(igc-icon) {
21-
color: var-get($theme, 'item-action-color-hover');
22-
}
36+
color: var-get($theme, 'item-text-color-hover');
2337

2438
[part='title'] {
2539
color: var-get($theme, 'item-title-color-hover');
@@ -38,18 +52,23 @@ $theme: $material;
3852
}
3953
}
4054

41-
[part='title'] {
42-
color: var-get($theme, 'item-title-color');
43-
}
55+
:host(:active) {
56+
color: var-get($theme, 'item-text-color-active');
57+
background: var-get($theme, 'item-background-active');
4458

45-
[part='subtitle'] {
46-
color: var-get($theme, 'item-subtitle-color');
47-
}
59+
[part='title'] {
60+
color: var-get($theme, 'item-title-color-active');
61+
}
4862

49-
[part='start'] {
50-
color: var-get($theme, 'item-thumbnail-color');
51-
}
63+
[part='subtitle'] {
64+
color: var-get($theme, 'item-subtitle-color-active');
65+
}
5266

53-
[part='end'] {
54-
color: var-get($theme, 'item-action-color');
67+
[part='start'] {
68+
color: var-get($theme, 'item-thumbnail-color-active');
69+
}
70+
71+
[part='end'] {
72+
color: var-get($theme, 'item-action-color-active');
73+
}
5574
}

src/components/list/themes/shared/item/list-item.fluent.scss

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
@use 'styles/utilities' as *;
2-
@use '../../light/themes' as *;
3-
4-
$theme: $fluent;
5-
6-
:host {
7-
border-bottom: rem(1px) solid var-get($theme, 'border-color');
8-
}
9-
10-
:host(:last-of-type) {
11-
border-bottom: none;
12-
}
132

143
[part='title'],
154
[part='subtitle'] {

src/components/list/themes/shared/item/list-item.indigo.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
}
1111
}
1212

13-
[part='title'],
14-
[part='subtitle'] {
13+
[part='title'] {
1514
@include type-style('body-2');
1615
}
1716

0 commit comments

Comments
 (0)