Last active
May 25, 2018 13:50
-
-
Save averymd/8e870bd293e8a4d8533105f8780e082a to your computer and use it in GitHub Desktop.
Example of Sass mixin that uses inheritance (for a talk)
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 rating-button($color) { | |
display: inline-block; | |
padding: $body-padding; | |
border-width: 1px; | |
background-color: $color; | |
border-color: tint($color, 50%); | |
box-shadow: 0 $body-padding shade($color, 50%); | |
color: black; | |
cursor: pointer; | |
font-weight: bold; | |
text-shadow: lighten($color, 25%) 1px 1px; | |
position: relative; | |
vertical-align: bottom; | |
margin-bottom: $body-padding * 1.5; | |
@include user-select(none); | |
.icon { | |
@extend .fa; | |
@extend .fa-circle-o; | |
} | |
input[type=checkbox]:checked + & { | |
position: relative; | |
top: $body-padding - 2px; | |
background-color: tint($color, 15%); | |
box-shadow: 0 2px shade($color, 50%); | |
.icon { | |
@extend .fa-arrow-circle-up; | |
} | |
} | |
input[type=checkbox]:disabled + & { | |
background-color: desaturate($color, 90%); | |
text-shadow: lighten(desaturate($color, 90%), 25%) 1px 1px; | |
box-shadow: 0 $body-padding desaturate(shade($color, 50%), 90%); | |
.icon { | |
@extend .fa-times-circle-o; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment