feat: simplify pill
class usage
This commit is contained in:
parent
72b80f7e8f
commit
c2471ea467
8 changed files with 55 additions and 138 deletions
|
@ -1,36 +1,26 @@
|
|||
{% from "macros/utils.njk" import stars %}
|
||||
|
||||
{% macro one(post, format, showType = true) %}
|
||||
<article class="[ posts-list-item column-gap-0.5 justify-between line-height-m ]">
|
||||
<div class="[ cluster gap-0.5 ]"><a href="{{ post.url }}" class="[ line-height-m ]">{{ post.data.title }}</a>
|
||||
{% if showType %}<p class="[ font-size-s text-fadeText ]">{{ post.data.tags[1] }}</p>{% endif %}</div>
|
||||
<div class="[ cluster ]">
|
||||
{% if post.data.rating %}
|
||||
{{ stars(post.data.rating) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</article>
|
||||
<article class="[ posts-list-item column-gap-0.5 justify-between line-height-m ]">
|
||||
<div class="[ cluster gap-0.5 ]">
|
||||
<a href="{{ post.url }}" class="[ line-height-m ]">{{ post.data.title }}</a>
|
||||
{% if showType %}<p class="[ font-size-s text-fadeText ]">{{ post.data.tags[1] }}</p>{% endif %}
|
||||
</div>
|
||||
<div class="[ cluster ]">
|
||||
{% if post.data.rating %}{{ stars(post.data.rating) }}{% endif %}
|
||||
</div>
|
||||
</article>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro list(posts, showType = true) %}
|
||||
<ol class="[ flow p-0 ]" role="list">
|
||||
{% for post in posts %}
|
||||
<li>
|
||||
{{ one(post, format, showType) }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
<ol class="[ flow p-0 ]" role="list">
|
||||
{% for post in posts %}<li>{{ one(post, format, showType) }}</li>{% endfor %}
|
||||
</ol>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro yearList(posts, year, format = "MM/DD", showType = true) %}
|
||||
<section class="[ flow ]">
|
||||
<header class="[ cluster gap-0.5 ]">
|
||||
<h2>{{ year }}</h2>
|
||||
<p class="[ pill ]" data-state="extrasmall">
|
||||
{{ posts | length }}
|
||||
</p>
|
||||
</header>
|
||||
{{ list(posts, format) }}
|
||||
</section>
|
||||
<section class="[ flow ]">
|
||||
<header class="[ cluster gap-0.5 ]">
|
||||
<h2>{{ year }}</h2>
|
||||
<p class="[ pill ]">{{ posts | length }}</p>
|
||||
</header>
|
||||
{{ list(posts, format) }}
|
||||
</section>
|
||||
{% endmacro %}
|
||||
|
||||
|
|
|
@ -1,29 +1,21 @@
|
|||
{% macro one(post, format = "MM/DD") %}
|
||||
<article class="[ posts-list-item column-gap-0.5 justify-between line-height-l ]">
|
||||
<a href="{{ post.url }}">{{ post.data.title }}</a>
|
||||
<time datetime="{{ post.date }}" class="[ text-fadeText ]">{{ post.date | formatDate(format) }}</time>
|
||||
<p class="[ text-fadeText font-size-s line-height-m ]">{{ post.data.excerpt }}</p>
|
||||
</article>
|
||||
<article class="[ posts-list-item column-gap-0.5 justify-between line-height-l ]">
|
||||
<a href="{{ post.url }}">{{ post.data.title }}</a>
|
||||
<time datetime="{{ post.date }}" class="[ text-fadeText ]">{{ post.date | formatDate(<built-in function format>) }}</time>
|
||||
<p class="[ text-fadeText font-size-s line-height-m ]">{{ post.data.excerpt }}</p>
|
||||
</article>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro list(posts, format = "MM/DD") %}
|
||||
<ol class="[ flow p-0 ]" role="list">
|
||||
{% for post in posts %}
|
||||
<li class="[ flow-space-0.5 ]">
|
||||
{{ one(post, format) }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
<ol class="[ flow p-0 ]" role="list">
|
||||
{% for post in posts %}<li class="[ flow-space-0.5 ]">{{ one(post, format) }}</li>{% endfor %}
|
||||
</ol>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro yearList(posts, year, format = "MM/DD") %}
|
||||
<section class="[ flow ]">
|
||||
<header class="[ cluster gap-0.5 ]">
|
||||
<h2>{{ year }}</h2>
|
||||
<p class="[ pill ]" data-state="extrasmall">
|
||||
{{ posts | length }}
|
||||
</p>
|
||||
</header>
|
||||
{{ list(posts, format) }}
|
||||
</section>
|
||||
<section class="[ flow ]">
|
||||
<header class="[ cluster gap-0.5 ]">
|
||||
<h2>{{ year }}</h2>
|
||||
<p class="[ pill ]">{{ posts | length }}</p>
|
||||
</header>
|
||||
{{ list(posts, format) }}
|
||||
</section>
|
||||
{% endmacro %}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{% set catalogueTypes = collections.catalogueByType | keys %}
|
||||
<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>
|
||||
<a class="[ button ]" href="/catalogue">all<span class="[ button__count ]">{{ collections.catalogue | length }}</span></a>
|
||||
</li>
|
||||
{% for type in catalogueTypes %}
|
||||
<li>
|
||||
<a class="[ pill ]" href="/catalogue/{{ type | pluralize }}">{{ type | pluralize }}<span class="[ pill-count ]">{{ collections.catalogueByType[ type ] | length }}</span></a>
|
||||
<a class="[ button ]" href="/catalogue/{{ type | pluralize }}">{{ type | pluralize }}<span class="[ button__count ]">{{ collections.catalogueByType[ type ] | length }}</span></a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue