feat: update catalogue layout

This commit is contained in:
Devin Haska 2024-02-23 15:50:04 -08:00
parent ef3a3b4295
commit 607593880c
5 changed files with 43 additions and 8 deletions

View file

@ -0,0 +1,14 @@
{% macro list(posts) %}
<ul class="[ catalogue-list ] [ flow list-none m-0 p-0 flow-space-0.5 ]">
{% for post in posts %}
<li class="[ catalogue-list-item line-height-l ]">
<div>
<a href="{{ post.url }}">{{ post.data.title }}</a>
</div>
<div class="[ font-size-s line-height-s flex items-center ]"><p class="[ bg-surface text-primary p-0.5 radius-0.25 ]">{{ post.data.tags[1] }}</p></div>
<div class="[ text-fadeText line-height-m flex items-center ]">{{ post.data.date | formatDate("MM/DD") }}</div>
</li>
{% endfor %}
</ul>
{% endmacro %}

View file

@ -11,4 +11,3 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% endmacro %} {% endmacro %}

View file

@ -12,6 +12,7 @@ eleventyComputed:
title: Catalogue - {{ type | pluralize | capitalize }} title: Catalogue - {{ type | pluralize | capitalize }}
--- ---
{% from "macros/catalogue.njk" import list %}
<h1>{{ type | pluralize | capitalize }}</h1> <h1>{{ type | pluralize | capitalize }}</h1>
{% set catalogueTypes = collections.catalogueByType | keys %} {% set catalogueTypes = collections.catalogueByType | keys %}
<ul class="[ cluster list-none p-0 ]" style="--gap: var(--spacing-0\.5)"> <ul class="[ cluster list-none p-0 ]" style="--gap: var(--spacing-0\.5)">
@ -22,5 +23,12 @@ eleventyComputed:
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
{% set items = collections.catalogueByType[ type ] | reverse %} {% set itemsByYear = collections.catalogueByType[type] | organizeByDate %}
{% include "partials/catalogue.html" %} {% set years = itemsByYear | keys | sort("desc") %}
<section class="[ flow ]">
{% for year in years %}
{% set itemsInYear = itemsByYear[year] %}
<h2>{{ year }}</h2>
<div class="[ items ] [ flex-col gap-0.25 ]">{{ list(itemsInYear) }}</div>
{% endfor %}
</section>

View file

@ -4,9 +4,9 @@ permalink: /catalogue/index.html
title: Catalogue title: Catalogue
--- ---
{% from "macros/catalogue.njk" import list %}
<h1>Catalogue</h1> <h1>Catalogue</h1>
<p>A collection of my thoughts on various forms of media that I consume.</p> <p>A collection of my thoughts on various forms of media that I consume.</p>
{% set items = collections.catalogue %}
{% set catalogueTypes = collections.catalogueByType | keys %} {% set catalogueTypes = collections.catalogueByType | keys %}
<ul class="[ cluster list-none p-0 ]" style="--gap: 0.5rem"> <ul class="[ cluster list-none p-0 ]" style="--gap: 0.5rem">
{% for type in catalogueTypes %} {% for type in catalogueTypes %}
@ -16,4 +16,13 @@ title: Catalogue
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
{% include "partials/catalogue.html" %} {% set itemsByYear = collections.catalogue | organizeByDate %}
{% set years = itemsByYear | keys | sort("desc") %}
<section class="[ flow ]">
{% for year in years %}
{% set itemsInYear = itemsByYear[year] %}
<h2>{{ year }}</h2>
<div class="[ items ] [ flex-col gap-0.25 ]">{{ list(itemsInYear) }}</div>
<div>{{ list(itemsInYear) }}</div>
{% endfor %}
</section>

View file

@ -1,6 +1,11 @@
.catalogue-type { .catalogue-list-item {
font-size: 0.8rem; display: grid;
border-radius: 0.5rem; grid-template-columns: 1fr auto auto;
gap: var(--spacing-1);
}
.catalogue-list-item a {
display: block;
} }
.catalogue source, .catalogue source,