Skip to content

Commit

Permalink
chore(chips): split out trailing icon styles
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 530736697
  • Loading branch information
asyncLiz authored and copybara-github committed May 9, 2023
1 parent ec47f9b commit 095355d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 38 deletions.
4 changes: 3 additions & 1 deletion chips/filter-chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {styles as elevatedStyles} from './lib/elevated-styles.css.js';
import {FilterChip} from './lib/filter-chip.js';
import {styles} from './lib/filter-styles.css.js';
import {styles as sharedStyles} from './lib/shared-styles.css.js';
import {styles as trailingIconStyles} from './lib/trailing-icon-styles.css.js';

declare global {
interface HTMLElementTagNameMap {
Expand All @@ -25,5 +26,6 @@ declare global {
*/
@customElement('md-filter-chip')
export class MdFilterChip extends FilterChip {
static override styles = [sharedStyles, elevatedStyles, styles];
static override styles =
[sharedStyles, elevatedStyles, trailingIconStyles, styles];
}
37 changes: 0 additions & 37 deletions chips/lib/_filter-chip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -135,41 +135,4 @@
.selected:active .icon {
color: var(--_selected-pressed-leading-icon-color);
}

.icon.trailing {
color: var(--_trailing-icon-color);
}

:hover .icon.trailing {
color: var(--_hover-trailing-icon-color);
}

:focus .icon.trailing {
color: var(--_focus-trailing-icon-color);
}

:active .icon.trailing {
color: var(--_pressed-trailing-icon-color);
}

.disabled .icon.trailing {
color: var(--_disabled-trailing-icon-color);
opacity: var(--_disabled-trailing-icon-opacity);
}

.selected .icon.trailing {
color: var(--_selected-trailing-icon-color);
}

.selected:hover .icon.trailing {
color: var(--_selected-hover-trailing-icon-color);
}

.selected:focus .icon.trailing {
color: var(--_selected-focus-trailing-icon-color);
}

.selected:active .icon.trailing {
color: var(--_selected-pressed-trailing-icon-color);
}
}
43 changes: 43 additions & 0 deletions chips/lib/_trailing-icon.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// Copyright 2023 Google LLC
// SPDX-License-Identifier: Apache-2.0
//

@mixin styles() {
.trailing .icon {
color: var(--_trailing-icon-color);
}

:hover .trailing .icon {
color: var(--_hover-trailing-icon-color);
}

:focus .trailing .icon {
color: var(--_focus-trailing-icon-color);
}

:active .trailing .icon {
color: var(--_pressed-trailing-icon-color);
}

.disabled .trailing .icon {
color: var(--_disabled-trailing-icon-color);
opacity: var(--_disabled-trailing-icon-opacity);
}

.selected .trailing .icon {
color: var(--_selected-trailing-icon-color);
}

.selected:hover .trailing .icon {
color: var(--_selected-hover-trailing-icon-color);
}

.selected:focus .trailing .icon {
color: var(--_selected-focus-trailing-icon-color);
}

.selected:active .trailing .icon {
color: var(--_selected-pressed-trailing-icon-color);
}
}
10 changes: 10 additions & 0 deletions chips/lib/trailing-icon-styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// Copyright 2023 Google LLC
// SPDX-License-Identifier: Apache-2.0
//

// go/keep-sorted start
@use './trailing-icon';
// go/keep-sorted end

@include trailing-icon.styles;

0 comments on commit 095355d

Please sign in to comment.