Skip to content

Commit

Permalink
feat(switch): add touch target token
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 661026784
  • Loading branch information
material-web-copybara authored and copybara-github committed Aug 8, 2024
1 parent e15f47e commit b8f362a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 5 additions & 2 deletions switch/internal/_switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,16 @@
// Input is also touch target
input {
appearance: none;
height: 48px;
height: max(100%, map.get($tokens, 'touch-target-size'));
outline: none;
margin: 0;
position: absolute;
width: 100%;
width: max(100%, map.get($tokens, 'touch-target-size'));
z-index: 1;
cursor: inherit;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

:host([touch-target='none']) input {
Expand Down
7 changes: 7 additions & 0 deletions tokens/_md-comp-switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ $supported-tokens: (
'selected-track-color',
'state-layer-shape',
'state-layer-size',
'touch-target-size',
'track-color',
'track-height',
'track-outline-color',
Expand Down Expand Up @@ -120,6 +121,12 @@ $_default: (
'handle-shape',
'track-shape'
);
$new-tokens: map.merge(
$new-tokens,
(
'touch-target-size': if($exclude-hardcoded-values, null, 48px)
)
);

$tokens: validate.values(
$tokens,
Expand Down

0 comments on commit b8f362a

Please sign in to comment.