Skip to content

Instantly share code, notes, and snippets.

@akfzambrana
Last active October 19, 2017 18:40
Show Gist options
  • Save akfzambrana/9640ce4c715ad3eb3ae5b017313bb277 to your computer and use it in GitHub Desktop.
Save akfzambrana/9640ce4c715ad3eb3ae5b017313bb277 to your computer and use it in GitHub Desktop.
Element Sass feedback generator (feat: @paulodetarso)
// 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))
);
}
.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