Use has-fa-icon in agree/disagree buttons

This way we can simplify the code in the views a little bit.
This commit is contained in:
Javi Martín
2022-01-13 19:50:50 +01:00
parent eecaf5876e
commit d347da8a33
2 changed files with 18 additions and 29 deletions

View File

@@ -7,8 +7,7 @@
display: inline-block;
}
.icon-like,
.icon-unlike {
button {
background: #fff;
border: 2px solid;
border-radius: rem-calc(3);
@@ -16,7 +15,7 @@
display: inline-block;
font-size: rem-calc(30);
line-height: rem-calc(30);
padding: rem-calc(3) rem-calc(6);
padding: rem-calc(3) rem-calc(6) rem-calc(6);
position: relative;
&:hover,
@@ -27,7 +26,8 @@
}
}
.icon-like {
.in-favor button {
@include has-fa-icon(thumbs-up, solid);
&:hover,
&:active {
@@ -36,7 +36,8 @@
}
}
.icon-unlike {
.against button {
@include has-fa-icon(thumbs-down, solid);
&:hover,
&:active {
@@ -67,29 +68,21 @@
}
.voted {
color: #fff;
}
.icon-like,
.icon-unlike {
color: #fff;
}
.in-favor .voted {
background: $like;
border: 2px solid $like;
}
.icon-like {
background: $like;
border: 2px solid $like;
}
.icon-unlike {
background: $unlike;
border: 2px solid $unlike;
}
.against .voted {
background: $unlike;
border: 2px solid $unlike;
}
.no-voted {
.icon-like,
.icon-unlike {
opacity: 0.3;
}
opacity: 0.3;
}
.against {

View File

@@ -7,9 +7,7 @@
method: "post",
remote: true,
disabled: !current_user do %>
<span class="icon-like">
<span class="show-for-sr"><%= t("votes.agree") %></span>
</span>
<span class="show-for-sr"><%= t("votes.agree") %></span>
<% end %>
<span class="percentage"><%= votes_percentage("likes", votable) %></span>
</div>
@@ -24,9 +22,7 @@
method: "post",
remote: true,
disabled: !current_user do %>
<span class="icon-unlike">
<span class="show-for-sr"><%= t("votes.disagree") %></span>
</span>
<span class="show-for-sr"><%= t("votes.disagree") %></span>
<% end %>
<span class="percentage"><%= votes_percentage("dislikes", votable) %></span>
</div>