This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(): add documentation for switch
- Loading branch information
Showing
7 changed files
with
84 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The switch component is similar to a checkbox, except it creates a draggable switch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,41 @@ | ||
material-switch { | ||
display: block; | ||
position: relative; | ||
width: $switch-width; | ||
height: $baseline-grid * 3; | ||
height: $baseline-grid * 4; | ||
|
||
@include flex-display(); | ||
@include flex-justify-content(center); | ||
@include flex-align-items(center); | ||
*{ | ||
outline: none !important; | ||
} | ||
|
||
.material-switch-bar { | ||
width: 32px; | ||
position: absolute; | ||
left: $baseline-grid * 2; | ||
top: $baseline-grid * 1.5; | ||
width: $baseline-grid * 4; | ||
height: 1px; | ||
background-color: #5a5a5a; | ||
pointer-events: none; | ||
} | ||
|
||
/* check _radio-button.scss */ | ||
/* used also in _radio-button.scss */ | ||
.material-switch-thumb { | ||
position: absolute; | ||
margin: 0; | ||
left: 0; | ||
top: 0; | ||
outline: none; | ||
|
||
-webkit-transition: -webkit-transform 0.2s linear; | ||
transition: transform 0.2s linear; | ||
@include transform-translate3d(0,0,0); | ||
|
||
&.material-checked { | ||
.material-container { | ||
-webkit-transition: -webkit-transform 0.2s linear; | ||
transition: transform 0.2s linear; | ||
@include transform-translate3d(0,0,0); | ||
} | ||
&.material-checked .material-container { | ||
@include transform-translate3d($switch-width - 16,0,0); | ||
} | ||
|
||
.material-label { | ||
margin-left: $baseline-grid * 7; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
<div ng-app="myApp"> | ||
<material-switch ng-model="val"></material-switch> | ||
<br/> | ||
Value: {{val}} | ||
<material-switch ng-model="data.cb1" aria-label="Switch 1"> | ||
Switch 1: {{ data.cb1 }} | ||
</material-switch> | ||
|
||
<material-switch ng-model="data.cb2" aria-label="Switch 2" ng-true-value="yup" ng-false-value="nope"> | ||
Switch 2: {{ data.cb2 }} | ||
</material-switch> | ||
|
||
<material-switch disabled aria-label="Disabled switch"> | ||
Switch (Disabled) | ||
</material-switch> | ||
|
||
<material-switch disabled aria-label="Disabled active switch" ng-model="data.cb4" ng-init="data.cb4=true"> | ||
Switch (Disabled, Active) | ||
</material-switch> | ||
|
||
<material-switch noink aria-label="Switch No Ink"> | ||
Switch (No Ink) | ||
</material-switch> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters