From 0d3c4c81546b79f446e468d91fdda486da002138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 21 Jan 2021 01:46:06 +0100 Subject: [PATCH] Simplify styling tags This way we won't have to add the `inline-block` and `no-bullet` classes to other elements and we can define the styles in one place. Note we're using the `ul.tags` selector instead of just `.tags` to avoid conflicts with a `div.tags` selector which is used to select tags in a form. Renaming the selector to `.tag-list` would be better, but we aren't doing so because it would break custom stylesheets using that selector. Also note we're keeping the %tags placeholder selector in `.tags` selector in the participation.scss file. This is so styles are not overwritten by selectors like `.debate-show ul li`, which has the same specifity as `ul.tags li`. --- app/assets/stylesheets/application.scss | 1 + app/assets/stylesheets/mixins.scss | 10 ++++++++++ app/assets/stylesheets/participation.scss | 8 +++----- app/assets/stylesheets/tags.scss | 6 ++++++ app/views/polls/_poll_group.html.erb | 4 ++-- app/views/polls/_poll_header.html.erb | 4 ++-- app/views/shared/_tags.html.erb | 6 +++--- app/views/users/_interests.html.erb | 4 ++-- 8 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 app/assets/stylesheets/tags.scss diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 0b899e516..ffb1517de 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -29,6 +29,7 @@ @import "jquery-ui/sortable"; @import "leaflet"; @import "sticky_overrides"; +@import "tags"; @import "admin/*"; @import "sdg/**/*"; @import "sdg_management/*"; diff --git a/app/assets/stylesheets/mixins.scss b/app/assets/stylesheets/mixins.scss index 906c0bc3f..ee6aef106 100644 --- a/app/assets/stylesheets/mixins.scss +++ b/app/assets/stylesheets/mixins.scss @@ -226,3 +226,13 @@ } } } + +%tags { + margin-bottom: 0; + margin-left: 0; + + li { + display: inline-block; + margin-bottom: 0; + } +} diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index a825c77bb..5290d20c8 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -408,10 +408,10 @@ } } - .tags, .geozone { li { + display: inline-block; margin-bottom: 0; } } @@ -487,8 +487,7 @@ } .tags { - display: block; - margin-bottom: 0; + @extend %tags; a { margin-right: rem-calc(6); @@ -673,8 +672,7 @@ } .tags { - display: block; - margin-bottom: 0; + @extend %tags; a { font-size: $tiny-font-size; diff --git a/app/assets/stylesheets/tags.scss b/app/assets/stylesheets/tags.scss new file mode 100644 index 000000000..b572da7a3 --- /dev/null +++ b/app/assets/stylesheets/tags.scss @@ -0,0 +1,6 @@ +ul { + + &.tags { + @extend %tags; + } +} diff --git a/app/views/polls/_poll_group.html.erb b/app/views/polls/_poll_group.html.erb index 95b1660aa..16da5efaa 100644 --- a/app/views/polls/_poll_group.html.erb +++ b/app/views/polls/_poll_group.html.erb @@ -47,9 +47,9 @@ <%= t("polls.index.geozone_info") %>

<% end %> -