Skip to content

Commit

Permalink
refactor(tree): mnake sure that only the disabled tree node looks dis…
Browse files Browse the repository at this point in the history
…abled
  • Loading branch information
desig9stein committed Oct 18, 2023
1 parent e2eee4c commit 7c2c5cb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 33 deletions.
21 changes: 10 additions & 11 deletions src/components/tree/themes/light/tree-item.bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ $theme: $bootstrap;
}

:host(:not([disabled])[selected]) {
background: var(--node-disabled-background, var-get($theme, 'background-selected'));
color: var(--node-disabled-foreground, var-get($theme, 'foreground-selected'));
background:var-get($theme, 'background-selected');
color: var-get($theme, 'foreground-selected');
}

:host(:not([disabled])[selected][active]) {
background: var(--node-disabled-background, var-get($theme, 'background-active-selected'));
color: var(--node-disabled-foreground, var-get($theme, 'foreground-active-selected'));
background: var-get($theme, 'background-active-selected');
color: var-get($theme, 'foreground-active-selected');
}

:host(:not([disabled])[selected]),
:host(:not([disabled])[selected][active]) {
[part~='focused'] {
background: var(--node-disabled-background, var-get($theme, 'background-active-selected'));
color: var(--node-disabled-foreground, var-get($theme, 'foreground-active-selected'));
background: var-get($theme, 'background-active-selected');
color: var-get($theme, 'foreground-active-selected');
}
}

Expand All @@ -57,9 +57,8 @@ $theme: $bootstrap;
}

:host([disabled]) {
--node-disabled-foreground: #{var-get($theme, 'foreground-disabled')};
--node-disabled-background: #{var-get($theme, 'background-disabled')};

color: var(--node-disabled-foreground);
background: var(--node-disabled-background);
[part~='wrapper'] {
color: var-get($theme, 'foreground-disabled');
background: var-get($theme, 'background-disabled');
}
}
37 changes: 15 additions & 22 deletions src/components/tree/themes/light/tree-item.material.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ $theme: $material;

:host {
@include css-vars-from-theme($theme, 'ig-tree');

background: var(--node-disabled-background, var-get($theme, 'background'));
color: var(--node-disabled-foreground, var-get($theme, 'foreground'));

}

[part~='wrapper'] {
Expand All @@ -22,38 +18,35 @@ $theme: $material;
}
}

:host(:not([disabled])[active]) {
[part~='label'] {
max-height: var-get($theme, 'size');
}

[part~='active'] {
background: var-get($theme, 'background-active');
color: var-get($theme, 'foreground-active');
}

:host(:not([disabled])[selected]) {
[part~='selected'] {
background: var-get($theme, 'background-selected');
color: var-get($theme, 'foreground-selected');
}

:host(:not([disabled])[selected][active]) {
background: var(--node-disabled-background, var-get($theme, 'background-active-selected'));
color: var(--node-disabled-foreground, var-get($theme, 'foreground-active-selected'));
}

:host(:not([disabled])[selected]),
:host(:not([disabled])[selected][active]) {
[part~='focused'] {
background: var(--node-disabled-background, var-get($theme, 'background-active-selected'));
color: var(--node-disabled-foreground, var-get($theme, 'foreground-active-selected'));
}
[part~='selected'][part~='focused'][part~='active'],
[part~='selected'][part~='focused'],
[part~='selected'][part~='active'] {
background: var-get($theme, 'background-active-selected');
color: var-get($theme, 'foreground-active-selected');
}

[part~='focused'] {
box-shadow: inset 0 0 0 1px var-get($theme, 'border-color');
}

:host([disabled]) {
--node-disabled-foreground: #{var-get($theme, 'foreground-disabled')};
--node-disabled-background: #{var-get($theme, 'background-disabled')};

color: var(--node-disabled-foreground);
background: var(--node-disabled-background);
[part~='wrapper'] {
color: var-get($theme, 'foreground-disabled');
background: var-get($theme, 'background-disabled');
}
}

0 comments on commit 7c2c5cb

Please sign in to comment.