Last active
October 19, 2017 18:40
-
-
Save akfzambrana/9640ce4c715ad3eb3ae5b017313bb277 to your computer and use it in GitHub Desktop.
Element Sass feedback generator (feat: @paulodetarso)
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
// Sorry, is very useless, but was very fun to do it! :P | |
// ---- | |
// Sass (v3.4.21) | |
// Compass (v1.0.3) | |
// ---- | |
@mixin default-feedback($feedback-status...) { | |
$prop-list: (); | |
@for $i from 1 through length($feedback-status) { | |
$prop-list: append($prop-list, nth($feedback-status, $i)); | |
} | |
@each $item in $feedback-status { | |
$status: nth($item, 1); | |
$length: length($item); | |
&:#{$status} { | |
@for $i from 2 through $length { | |
$sub-list: nth($item, $i); | |
$property: nth($sub-list, 1); | |
$value: nth($sub-list, 2); | |
#{$property}: #{$value} | |
} | |
} | |
} | |
} | |
.button { | |
@include default-feedback( | |
(hover, (background, red), (color, pink)), | |
(focus, (background, blue)), | |
(active, (color, green)) | |
); | |
} |
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
.button:hover { | |
background: red; | |
color: pink; | |
} | |
.button:focus { | |
background: blue; | |
} | |
.button:active { | |
color: green; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment