Simplify stats images styles

This way we don't need to manually define the width we think the image
we insert in the `::before` pseudoclass is going to take.
This commit is contained in:
Javi Martín
2019-01-04 19:19:44 +01:00
parent 4ade857a1b
commit c4c0301f3f
3 changed files with 12 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -22,20 +22,14 @@
.number-with-info { .number-with-info {
display: inline-block; display: inline-block;
margin-right: $line-height * 2;
&.participants { &::before {
padding-left: $line-height * 2.5; display: inline-block;
position: relative; margin-right: $line-height / 2;
&::before {
left: 0;
position: absolute;
}
} }
&.total-participants::before { &.total-participants::before {
content: image-url('stats_man.png'); content: image-url('stats_users.png');
} }
&.male::before { &.male::before {
@@ -46,6 +40,11 @@
content: image-url('stats_woman.png'); content: image-url('stats_woman.png');
} }
.content {
display: inline-block;
margin-right: $line-height * 2;
}
.number { .number {
display: block; display: block;
font-size: rem-calc(60); font-size: rem-calc(60);

View File

@@ -37,7 +37,9 @@ module StatsHelper
def number_with_info_tags(number, text, html_class: "") def number_with_info_tags(number, text, html_class: "")
content_tag :p, class: "number-with-info #{html_class}".strip do content_tag :p, class: "number-with-info #{html_class}".strip do
content_tag(:span, number, class: "number") + content_tag(:span, text, class: "info") content_tag :span, class: "content" do
content_tag(:span, number, class: "number") + content_tag(:span, text, class: "info")
end
end end
end end
end end