Skip to content

Commit 48d84f8

Browse files
asyncLizcopybara-github
authored andcommitted
chore(button): remove BEM css class name style
Why? We don't use https://getbem.com/ styles anymore now that we have shadow dom. Just cleanup to help with child changes. PiperOrigin-RevId: 579980984
1 parent 798f5ae commit 48d84f8

File tree

5 files changed

+22
-27
lines changed

5 files changed

+22
-27
lines changed

button/internal/_outlined-button.scss

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
);
6565
}
6666

67-
.button__outline {
67+
.outline {
6868
inset: 0;
6969
border-style: solid;
7070
position: absolute;
@@ -76,35 +76,30 @@
7676
border-end-end-radius: var(--_container-shape-end-end);
7777
}
7878

79-
:host(:active) .button__outline {
79+
:host(:active) .outline {
8080
border-color: var(--_pressed-outline-color);
8181
}
8282

83-
:host([disabled]) .button__outline {
83+
:host([disabled]) .outline {
8484
border-color: var(--_disabled-outline-color);
8585
opacity: var(--_disabled-outline-opacity);
8686
}
8787

8888
@media (forced-colors: active) {
89-
:host([disabled]) .button__outline {
89+
:host([disabled]) .outline {
9090
opacity: 1;
9191
}
9292
}
9393

94-
.button__outline,
95-
.button__ripple {
94+
.outline,
95+
md-ripple {
9696
border-width: var(--_outline-width);
9797
}
9898

99-
.button__ripple {
99+
md-ripple {
100100
inline-size: calc(100% - 2 * var(--_outline-width));
101101
block-size: calc(100% - 2 * var(--_outline-width));
102102
border-style: solid;
103103
border-color: transparent;
104104
}
105105
}
106-
107-
@function _resolve-tokens($tokens) {
108-
$tokens: shared.remove-unsupported-tokens($tokens);
109-
@return $tokens;
110-
}

button/internal/_shared.scss

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
);
3838
}
3939

40-
:host([touch-target='wrapper']) {
41-
margin: max(0px, (48px - var(--_container-height)) / 2) 0;
42-
}
43-
4440
md-focus-ring {
4541
@include focus-ring.theme(
4642
(
@@ -109,7 +105,7 @@
109105
position: absolute;
110106
}
111107

112-
:host([disabled]) .button__label {
108+
:host([disabled]) .label {
113109
color: var(--_disabled-label-text-color);
114110
opacity: var(--_disabled-label-text-opacity);
115111
}
@@ -138,7 +134,7 @@
138134
}
139135

140136
.button,
141-
.button__ripple {
137+
md-ripple {
142138
border-start-start-radius: var(--_container-shape-start-start);
143139
border-start-end-radius: var(--_container-shape-start-end);
144140
border-end-start-radius: var(--_container-shape-end-start);
@@ -148,17 +144,17 @@
148144
.button::after,
149145
.button::before,
150146
md-elevation,
151-
.button__ripple {
147+
md-ripple {
152148
z-index: -1; // Place behind content
153149
}
154150

155151
// TODO(b/181413732): Verify token below are named correctly
156-
.button--icon-leading {
152+
.icon-leading {
157153
padding-inline-start: var(--_with-leading-icon-leading-space);
158154
padding-inline-end: var(--_with-leading-icon-trailing-space);
159155
}
160156

161-
.button--icon-trailing {
157+
.icon-trailing {
162158
padding-inline-start: var(--_with-trailing-icon-leading-space);
163159
padding-inline-end: var(--_with-trailing-icon-trailing-space);
164160
}

button/internal/_touch-target.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
transform: translateY(-50%);
1414
}
1515

16+
:host([touch-target='wrapper']) {
17+
margin: max(0px, (48px - var(--_container-height)) / 2) 0;
18+
}
19+
1620
:host([touch-target='none']) .touch {
1721
display: none;
1822
}

button/internal/button.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ export abstract class Button extends buttonBaseClass implements FormSubmitter {
137137

138138
protected getRenderClasses() {
139139
return {
140-
'button--icon-leading': !this.trailingIcon && this.hasIcon,
141-
'button--icon-trailing': this.trailingIcon && this.hasIcon,
140+
'icon-leading': !this.trailingIcon && this.hasIcon,
141+
'icon-trailing': this.trailingIcon && this.hasIcon,
142142
};
143143
}
144144

@@ -154,12 +154,12 @@ export abstract class Button extends buttonBaseClass implements FormSubmitter {
154154
@slotchange="${this.handleSlotChange}"></slot>`;
155155

156156
return html`
157-
${this.renderElevation?.()} ${this.renderOutline?.()}
157+
${this.renderElevation?.()}${this.renderOutline?.()}
158158
<md-focus-ring part="focus-ring"></md-focus-ring>
159-
<md-ripple class="button__ripple" ?disabled="${isDisabled}"></md-ripple>
159+
<md-ripple ?disabled="${isDisabled}"></md-ripple>
160160
<span class="touch"></span>
161161
${this.trailingIcon ? nothing : icon}
162-
<span class="button__label"><slot></slot></span>
162+
<span class="label"><slot></slot></span>
163163
${this.trailingIcon ? icon : nothing}
164164
`;
165165
}

button/internal/outlined-button.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ import {Button} from './button.js';
1313
*/
1414
export class OutlinedButton extends Button {
1515
protected override renderOutline() {
16-
return html`<span class="button__outline"></span>`;
16+
return html`<span class="outline"></span>`;
1717
}
1818
}

0 commit comments

Comments
 (0)