forked from codegouvfr/eleventy-dsfr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard.njk
54 lines (54 loc) · 1.91 KB
/
card.njk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{% if not card %}{% set card = params %}{% endif %}
<div class="fr-card{% if not card.externalUrl %} fr-enlarge-link{% endif %}{% if card.orientation == 'horizontal' %} fr-card--horizontal-tier{% endif %}">
<div class="fr-card__body">
<div class="fr-card__content">
{% set cardUrl = card.url | locale_url or card.externalUrl %}
<h3 class="fr-card__title">
{% if not card.externalUrl %}
<a href="{{ cardUrl }}">
{{ card.title }}
</a>
{% else %}{{ card.title }}
{% endif %}
</h3>
<p class="fr-card__desc">{{ card.description | safe }}</p>
<div class="fr-card__start">
{% if card.tags %}
{% set tags = card.tags %}
{% include "components/taggroup-disabled.njk" %}
{% endif %}
{% if card.date %}
<p class="fr-card__detail fr-icon-time-fill">
<time class="postlist-date" datetime="{{ card.date | htmlDateString }}">
{{ card.date | readableDate }}
</time>
</p>
{% endif %}
</div>
</div>
<div class="fr-card__footer">
{% if card.externalUrl %}
<ul class="fr-links-group">
<li>
<a class="fr-link fr-icon-arrow-right-line fr-link--icon-right" href="{{ card.externalUrl }}"
title="{{ card.title }} - {{ "new_window" | i18n }}" target="_blank">
{{ card.urlDescription or "see_more" | i18n }}
</a>
</li>
</ul>
{% endif %}
</div>
</div>
<div class="fr-card__header">
{% if card.badges %}
<ul class="fr-badges-group">
{% for badge in card.badges %}
<li><p class="fr-badge fr-badge--green-emeraude">{{ badge }}</p></li>
{% endfor %}
</ul>
{% endif %}
{% if card.image.path %}
<div class="fr-card__img">{% imageSync card.image.path, card.image.alt %}</div>
{% endif %}
</div>
</div>