Skip to content

Commit 468d997

Browse files
sayriscopybara-github
authored andcommitted
feat(tab): Moves rendering of md-icon up to the outer/wrapping primary-tab and secondary-tab files.
PiperOrigin-RevId: 445230622
1 parent d009d36 commit 468d997

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

components/tabs/tab/lib/tab.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
import '../../../focus/focus-ring';
11-
import '../../../icon/icon';
1211

1312
import {addHasRemoveClass, BaseElement} from '@material/mwc-base/base-element';
1413
import {observer} from '@material/mwc-base/observer';
@@ -139,8 +138,7 @@ export class Tab extends BaseElement {
139138

140139
/** @soyTemplate */
141140
protected renderIcon(icon: string): TemplateResult {
142-
return html`<md-icon class="md3-tab__icon"><slot name="icon">${
143-
icon}</slot></md-icon>`;
141+
return html``;
144142
}
145143

146144
/** @soyTemplate */

components/tabs/tab/primary-tab.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import '../tab_indicator/tab-indicator';
8+
import '../../icon/icon';
89

910
import {html, TemplateResult} from 'lit';
1011
import {customElement} from 'lit/decorators';
@@ -38,4 +39,10 @@ export class MdPrimaryTab extends PrimaryTab {
3839
.icon="${indicatorIcon}"
3940
.fade="${isFadingIndicator}"></md-tab-indicator>`;
4041
}
42+
43+
/** @soyTemplate */
44+
protected override renderIcon(icon: string): TemplateResult {
45+
return html`<md-icon class="md3-tab__icon"><slot name="icon">${
46+
icon}</slot></md-icon>`;
47+
}
4148
}

components/tabs/tab/secondary-tab.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import '../tab_indicator/tab-indicator';
8+
import '../../icon/icon';
89

910
import {html, TemplateResult} from 'lit';
1011
import {customElement} from 'lit/decorators';
@@ -38,4 +39,10 @@ export class MdSecondaryTab extends SecondaryTab {
3839
.icon="${indicatorIcon}"
3940
.fade="${isFadingIndicator}"></md-tab-indicator>`;
4041
}
42+
43+
/** @soyTemplate */
44+
protected override renderIcon(icon: string): TemplateResult {
45+
return html`<md-icon class="md3-tab__icon"><slot name="icon">${
46+
icon}</slot></md-icon>`;
47+
}
4148
}

0 commit comments

Comments
 (0)