Skip to content

Commit

Permalink
✨ feat(tags): dynamically adjust tag list columns based on tag count (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
welpo committed Dec 30, 2023
1 parent d257e02 commit 9fc45f2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
32 changes: 30 additions & 2 deletions sass/parts/_tags.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.tag-cloud {
#tag-cloud {
margin-top: 4vmin;

ul {
Expand All @@ -8,6 +8,34 @@
}

.tags-item {
margin-top: 1rem;
margin-bottom: 1rem;
}
}

@mixin column-count($count) {
-webkit-column-count: $count;
-moz-column-count: $count;
column-count: $count;
}

.two-columns ul {
@include column-count(2);
}

.three-columns ul {
@include column-count(3);
}

@media (max-width: 1000px) {
.three-columns ul {
@include column-count(2);
}
}

@media (max-width: 600px) {

.two-columns ul,
.three-columns ul {
@include column-count(1);
}
}
3 changes: 2 additions & 1 deletion templates/tags/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

{{ macros_page_header::page_header(title=title)}}

<div class="tag-cloud">
{% set tag_count = terms | length %}
<div id="tag-cloud" class="{% if tag_count > 16 %}three-columns{% elif tag_count > 8 %}two-columns{% endif %}">
<ul class="tags">
{%- for term in terms -%}
<li class="tags-item">
Expand Down

0 comments on commit 9fc45f2

Please sign in to comment.