Skip to content

Commit d1edc1d

Browse files
author
hjonin
committed
add horizontal card and postslist layouts
1 parent 0cd49d6 commit d1edc1d

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{# Mandatory variable `card { url: string, title: string, description: string, tags: string[], date: string, imagePath: string, imageAlt: string }` to make it work #}
2+
<div class="fr-card fr-enlarge-link fr-card--horizontal-tier">
3+
<div class="fr-card__body">
4+
<div class="fr-card__content">
5+
<h3 class="fr-card__title"><a href="{{ card.url | locale_url }}">{{ card.title }}</a></h3>
6+
<p class="fr-card__desc">{{ card.description }}</p>
7+
<div class="fr-card__start">
8+
{% set tags = card.tags %}
9+
{% include "components/taggroup-disabled.njk" %}
10+
<p class="fr-card__detail fr-icon-time-fill">
11+
<time class="postlist-date"
12+
datetime="{{ card.date | htmlDateString }}">{{ card.date | readableDate("LLLL yyyy") }}</time>
13+
</p>
14+
</div>
15+
</div>
16+
</div>
17+
{% if card.imagePath %}
18+
<div class="fr-card__header">
19+
<div class="fr-card__img">{% image card.imagePath, card.imageAlt %}</div>
20+
</div>
21+
{% endif %}
22+
</div>

_includes/postslist-horizontal.njk

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{# Mandatory variable `postslist: CollectionItem[]` to make it work #}
2+
<div class="fr-grid-row fr-grid-row--gutters fr-mb-3w">
3+
{% asyncAll post in postslist %}
4+
<div class="fr-col-12">
5+
{% set card = {
6+
url: post.url,
7+
title: post.data.title,
8+
description: post.data.description,
9+
tags: post.data.tags,
10+
date: post.date,
11+
imagePath: post.data.image.path,
12+
imageAlt: post.data.image.alt
13+
} %}
14+
{% include "components/card-horizontal.njk" %}
15+
</div>
16+
{% endall %}
17+
</div>

content/fr/blog/index.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ eleventyNavigation:
1919
</div>
2020
<div class="fr-col-12 fr-col-md-9">
2121
{% set postslist = pagination.items %}
22-
{% include "postslist.njk" %}
22+
{% include "postslist-horizontal.njk" %}
2323
{% include "components/pagination.njk" %}
2424
</div>
2525
</div>

0 commit comments

Comments
 (0)