Skip to content

Commit

Permalink
refactor(iconbutton): set target size directly on host, same as radio…
Browse files Browse the repository at this point in the history
… and checkbox

PiperOrigin-RevId: 501020595
  • Loading branch information
dfreedm authored and copybara-github committed Jan 10, 2023
1 parent 4974ede commit 82d7556
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
10 changes: 4 additions & 6 deletions iconbutton/lib/_shared.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@
display: inline-flex;
outline: none;
-webkit-tap-highlight-color: transparent;
height: max(48px, var(--_container-size));
width: max(48px, var(--_container-size));
align-items: center;
justify-content: center;
}

:host([disabled]) {
pointer-events: none;
}

.md3-icon-button {
$touch-target-height: 48px;

align-items: center;
border: none;
box-sizing: border-box;
Expand All @@ -44,10 +46,6 @@
z-index: 0;
height: var(--_container-size);
width: var(--_container-size);
margin: max(
0px,
calc((#{$touch-target-height} - var(--_container-size)) / 2)
);
border-start-start-radius: var(--_container-shape-start-start);
border-start-end-radius: var(--_container-shape-start-end);
border-end-start-radius: var(--_container-shape-end-start);
Expand Down
8 changes: 3 additions & 5 deletions iconbutton/lib/_standard-icon-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ $_custom-property-prefix: 'icon-button';
--_#{$token}: #{$value};
}

height: max(48px, var(--_state-layer-size));
width: max(48px, var(--_state-layer-size));

@include focus-ring.theme(
(
shape: (
Expand All @@ -48,15 +51,10 @@ $_custom-property-prefix: 'icon-button';
}

.md3-icon-button--standard {
$touch-target-height: 48px;
background-color: transparent;
color: var(--_unselected-icon-color);
height: var(--_state-layer-size);
width: var(--_state-layer-size);
margin: max(
0px,
calc((#{$touch-target-height} - #{var(--_state-layer-size)}) / 2)
);

@include ripple.theme(
(
Expand Down

0 comments on commit 82d7556

Please sign in to comment.