Last active
May 16, 2020 22:27
-
-
Save rossberenson/b9a0ec8b4191b3f9ce512d09f14d4542 to your computer and use it in GitHub Desktop.
SCSS Mixin to use with What-Input
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
/** | |
* Mixin for What-Input | |
* https://github.com/ten1seven/what-input | |
* | |
* Example use: | |
* .element { | |
* @include what-input(keyboard) { | |
* outline: 1px dotted black; | |
* } | |
*/ | |
@mixin what-input($input) { | |
$available-inputs: keyboard, mouse, touch; | |
@if index($available-inputs, $input) { | |
html[data-whatinput="#{$input}"] & { | |
@content; | |
} | |
} | |
@else { | |
@error "Sorry, but #{$input} is not an available input. The available inputs are: #{$available-inputs}."; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment