Extract mixin to add font awesome icons
This way we can simplify the HTML and easily apply font awesome icons to
any element.
Note the mixin uses `extend`, which we generally try to avoid. It's OK
in this case, since `fa-` classes only have one rule, affecting the
content of its `::before` pseudo-element. Unfortunately we can't use
`include fa-content($fa-var-#{$icon})` because it's not valid SCSS. We
could make the mixin accept an icon instead of an icon name, and call it
using `has-fa-icon(r, $fa-var-plus-square)`. However, IMHO that would
make the code a bit more complex with no real benefit.
This commit is contained in:
@@ -2045,10 +2045,6 @@ table {
|
|||||||
padding: $line-height / 4;
|
padding: $line-height / 4;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.relative {
|
|
||||||
padding-left: rem-calc(18);
|
|
||||||
}
|
|
||||||
|
|
||||||
.divider {
|
.divider {
|
||||||
color: $text-light;
|
color: $text-light;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -2060,24 +2056,23 @@ table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.responses-count {
|
.responses-count {
|
||||||
.far {
|
|
||||||
@extend .fa-minus-square;
|
|
||||||
font-size: $small-font-size;
|
|
||||||
left: 0;
|
|
||||||
position: absolute;
|
|
||||||
text-decoration: none;
|
|
||||||
top: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.show-children {
|
.show-children {
|
||||||
|
@include has-fa-icon(plus-square, r);
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.collapsed {
|
.collapse-children {
|
||||||
.far {
|
@include has-fa-icon(minus-square, r);
|
||||||
@extend .fa-plus-square;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.show-children::before,
|
||||||
|
.collapse-children::before {
|
||||||
|
margin-right: rem-calc(6);
|
||||||
|
transform: translateY(1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.collapsed {
|
||||||
|
|
||||||
.collapse-children {
|
.collapse-children {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,3 +148,18 @@
|
|||||||
transition: none;
|
transition: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@mixin has-fa-icon($icon, $style) {
|
||||||
|
@extend .fa-#{$icon};
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
@extend %fa-icon;
|
||||||
|
font-family: "Font Awesome 5 Free";
|
||||||
|
|
||||||
|
@if $style == "r" {
|
||||||
|
font-weight: normal;
|
||||||
|
} @else {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<% if count > 0 %>
|
<% if count > 0 %>
|
||||||
<%= link_to "", class: "js-toggle-children relative" do %>
|
<%= link_to "", class: "js-toggle-children" do %>
|
||||||
<span class="far"></span>
|
|
||||||
<span class="show-children"><%= t("comments.comment.responses_show", count: count) %></span>
|
<span class="show-children"><%= t("comments.comment.responses_show", count: count) %></span>
|
||||||
<span class="collapse-children"><%= t("comments.comment.responses_collapse", count: count) %></span>
|
<span class="collapse-children"><%= t("comments.comment.responses_collapse", count: count) %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user