feat: update catalogue list

This commit is contained in:
Devin Haska 2024-03-01 15:48:42 -08:00
parent e2d26a8b9a
commit b5fd748a55
5 changed files with 13 additions and 10 deletions

View file

@ -1,11 +1,10 @@
{% from "macros/utils.njk" import stars %} {% from "macros/utils.njk" import stars %}
{% macro one(post, format) %} {% macro one(post, format, showType = true) %}
<article class="[ posts-list-item column-gap-0.5 justify-between line-height-m ]"> <article class="[ posts-list-item column-gap-0.5 justify-between line-height-m ]">
<a href="{{ post.url }}">{{ post.data.title }}</a> <div class="[ cluster gap-0.5 ]"><a href="{{ post.url }}" class="[ line-height-m ]">{{ post.data.title }}</a>
<time datetime="{{ post.date }}" class="[ text-fadeText ]">{{ post.date | formatDate("MM/DD") }}</time> {% if showType %}<p class="[ font-size-s text-fadeText ]">{{ post.data.tags[1] }}</p>{% endif %}</div>
<div class="[ cluster mt-0.5 ]"> <div class="[ cluster ]">
<div class="[ font-size-s ]"><p class="[ pill ]" data-state="small">{{ post.data.tags[1] }}</p></div>
{% if post.data.rating %} {% if post.data.rating %}
{{ stars(post.data.rating) }} {{ stars(post.data.rating) }}
{% endif %} {% endif %}
@ -13,17 +12,17 @@
</article> </article>
{% endmacro %} {% endmacro %}
{% macro list(posts) %} {% macro list(posts, showType = true) %}
<ol class="[ flow p-0 ]" role="list"> <ol class="[ flow p-0 ]" role="list">
{% for post in posts %} {% for post in posts %}
<li> <li>
{{ one(post, format) }} {{ one(post, format, showType) }}
</li> </li>
{% endfor %} {% endfor %}
</ol> </ol>
{% endmacro %} {% endmacro %}
{% macro yearList(posts, year, format = "MM/DD") %} {% macro yearList(posts, year, format = "MM/DD", showType = true) %}
<section class="[ flow ]"> <section class="[ flow ]">
<header class="[ cluster gap-0.5 ]"> <header class="[ cluster gap-0.5 ]">
<h2>{{ year }}</h2> <h2>{{ year }}</h2>

View file

@ -1,5 +1,8 @@
{% set catalogueTypes = collections.catalogueByType | keys %} {% set catalogueTypes = collections.catalogueByType | keys %}
<ul class="[ cluster p-0 gap-0.5 ]" role="list"> <ul class="[ cluster p-0 gap-0.5 ]" role="list">
<li>
<a class="[ pill ]" href="/catalogue">all<span class="[ pill-count ]">{{ collections.catalogue | length }}</span></a>
</li>
{% for type in catalogueTypes %} {% for type in catalogueTypes %}
<li> <li>
<a class="[ pill ]" href="/catalogue/{{ type | pluralize }}">{{ type | pluralize }}<span class="[ pill-count ]">{{ collections.catalogueByType[ type ] | length }}</span></a> <a class="[ pill ]" href="/catalogue/{{ type | pluralize }}">{{ type | pluralize }}<span class="[ pill-count ]">{{ collections.catalogueByType[ type ] | length }}</span></a>

View file

@ -1,7 +1,7 @@
<ul class="[ list-none cluster p-0 m-0 ]"> <ul class="[ list-none cluster p-0 m-0 ]">
{% for item in navigation.top %} {% for item in navigation.top %}
<li> <li>
<a href="{{ item.url }}" {{ helpers.getLinkActiveState(item.url, page.url) | safe }}>{{ item.text }}</a> <a href="{{ item.url }}">{{ item.text }}</a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View file

@ -20,6 +20,6 @@ eleventyComputed:
<section class="[ flow ]"> <section class="[ flow ]">
{% for year in years %} {% for year in years %}
{% set itemsInYear = itemsByYear[year] %} {% set itemsInYear = itemsByYear[year] %}
{{ yearList(itemsInYear, year) }} {{ yearList(itemsInYear, year, false) }}
{% endfor %} {% endfor %}
</section> </section>

View file

@ -15,6 +15,7 @@
font-size: 0.8rem; font-size: 0.8rem;
line-height: 0.8rem; line-height: 0.8rem;
padding-inline: var(--spacing-0\.5); padding-inline: var(--spacing-0\.5);
padding-block: var(--spacing-0\.25);
border-radius: var(--spacing-0\.25); border-radius: var(--spacing-0\.25);
} }