Refactor like/unlike buttons SCSS
We were using the same selectors three times. Since we're going to change that part of the code, we're simplifying it so we don't have to do the same changes three times.
This commit is contained in:
@@ -22,41 +22,30 @@
|
|||||||
line-height: rem-calc(30);
|
line-height: rem-calc(30);
|
||||||
padding: rem-calc(3) rem-calc(6) rem-calc(6);
|
padding: rem-calc(3) rem-calc(6) rem-calc(6);
|
||||||
position: relative;
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin like-unlike-icon($icon, $pressed-color) {
|
||||||
|
@include has-fa-icon($icon, solid);
|
||||||
|
|
||||||
&:not([disabled]) {
|
&:not([disabled]) {
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
&:active,
|
&:active,
|
||||||
&[aria-pressed=true] {
|
&[aria-pressed=true] {
|
||||||
|
background: $pressed-color;
|
||||||
|
border-color: $pressed-color;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.in-favor button {
|
.in-favor button {
|
||||||
@include has-fa-icon(thumbs-up, solid);
|
@include like-unlike-icon(thumbs-up, $like);
|
||||||
|
|
||||||
&:not([disabled]) {
|
|
||||||
&:hover,
|
|
||||||
&:active,
|
|
||||||
&[aria-pressed=true] {
|
|
||||||
background: $like;
|
|
||||||
border-color: $like;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.against button {
|
.against button {
|
||||||
@include has-fa-icon(thumbs-down, solid);
|
@include like-unlike-icon(thumbs-down, $unlike);
|
||||||
|
|
||||||
&:not([disabled]) {
|
|
||||||
&:hover,
|
|
||||||
&:active,
|
|
||||||
&[aria-pressed=true] {
|
|
||||||
background: $unlike;
|
|
||||||
border-color: $unlike;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.percentage {
|
.percentage {
|
||||||
|
|||||||
@@ -1707,22 +1707,21 @@ table {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.in-favor button {
|
@mixin like-unlike-icon($icon, $pressed-color) {
|
||||||
@include has-fa-icon(thumbs-up, solid);
|
@include has-fa-icon($icon, solid);
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
&[aria-pressed=true] {
|
&[aria-pressed=true] {
|
||||||
color: $like;
|
color: $pressed-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.in-favor button {
|
||||||
|
@include like-unlike-icon(thumbs-up, $like);
|
||||||
|
}
|
||||||
|
|
||||||
.against button {
|
.against button {
|
||||||
@include has-fa-icon(thumbs-down, solid);
|
@include like-unlike-icon(thumbs-down, $unlike);
|
||||||
|
|
||||||
&:hover,
|
|
||||||
&[aria-pressed=true] {
|
|
||||||
color: $unlike;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user