Skip to content

Commit

Permalink
fix(icon,iconbutton,list)!: use material symbols for icons
Browse files Browse the repository at this point in the history
- Material Symbols is recommended for M3
- Refactor list items to use md-icon directly

PiperOrigin-RevId: 511601359
  • Loading branch information
dfreedm authored and copybara-github committed Feb 22, 2023
1 parent c633e85 commit 232982e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 27 deletions.
2 changes: 1 addition & 1 deletion icon/lib/_icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $_custom-property-prefix: 'icon';
font-weight: var(--_weight);
font-style: normal;
font-size: var(--_size);
font-variation-settings: var(--_font-varation-settings);
font-variation-settings: var(--_font-variation-settings);
line-height: 1;
letter-spacing: normal;
text-transform: none;
Expand Down
3 changes: 1 addition & 2 deletions icon/lib/_md-comp-icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
$values: (
(
color: if($exclude-hardcoded-values, null, inherit),
// TODO(b/225384738): Change to 'Material Symbols Outlined'
font: if($exclude-hardcoded-values, null, 'Material Icons'),
font: if($exclude-hardcoded-values, null, 'Material Symbols Outlined'),
font-variation-settings: if($exclude-hardcoded-values, null, inherit),
size: if($exclude-hardcoded-values, null, 24px),
weight: if($exclude-hardcoded-values, null, 400),
Expand Down
30 changes: 7 additions & 23 deletions list/lib/icon/_list-item-icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@use 'sass:map';
// go/keep-sorted end
// go/keep-sorted start
@use '../../../icon/icon';
@use '../../../sass/map-ext';
@use '../../../sass/theme';
// go/keep-sorted end
Expand Down Expand Up @@ -42,30 +43,13 @@ $_reference: (
}

.md3-list-item__icon {
color: var(--_list-item-icon-color);
@include icon.theme(
(
color: var(--_list-item-icon-color),
size: var(--_list-item-icon-size),
)
);
opacity: var(--_list-item-icon-opacity);
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: var(--_list-item-icon-size);
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-flex;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
height: 100%;
width: 100%;
padding-inline-start: 16px;

/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;
/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
/* Support for IE. */
font-feature-settings: 'liga';
}
}
4 changes: 3 additions & 1 deletion list/lib/icon/list-item-icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
* SPDX-License-Identifier: Apache-2.0
*/

import '../../../icon/icon.js';

import {html, LitElement, TemplateResult} from 'lit';

// tslint:disable-next-line:enforce-comments-on-exported-symbols
export class ListItemIcon extends LitElement {
override render(): TemplateResult {
return html`
<span class="md3-list-item__icon"><slot></slot></span>
<md-icon class="md3-list-item__icon"><slot></slot></md-icon>
`;
}
}

0 comments on commit 232982e

Please sign in to comment.