{% set size = size ?? 'M' %}
{% set picSizes = [[454, 244], [467, 251], [703, 377], [356,191]] %}
{% if size == 'L' %}
{# same from mobile to lg, more landscape for desktop #}
{% set picSizes = [[680, 260], [467, 251], [703, 377], [356,191]] %}
{% endif %}
{% set templateType = 'pic' %}
{% if type == 'study' %}
{% set ctaLabel = 'Lire l\'étude' %}
{% set tag = 'Étude' %}
{% elseif type == 'activity-report' %}
{% set ctaLabel = 'Voir le rapport d\'activité' %}
{% set tag = 'Rapport d\'activité' %}
{% elseif type == 'thematic-brochure' %}
{% set templateType = 'picto' %}
{% set ctaLabel = 'Voir la plaquette' %}
{% set tag = 'Plaquette thématique' %}
{% elseif type == 'practical-guide' %}
{% set templateType = 'picto' %}
{% set ctaLabel = 'Voir la note adhérent' %}
{% set tag = 'Note adhérent' %}
{% elseif type == 'btob-news' %}
{% set ctaLabel = 'Lire le BtoB news' %}
{% set tag = 'BtoB news' %}
{% elseif type == 'barometer-activity' %}
{% set ctaLabel = 'Découvrir le baromètre' %}
{% set tag = 'Baromètre d\'activité' %}
{% endif %}
<div class="card-common card-common--{{ size }} card-publi card-publi--{{ type }} {{ templateType == 'picto' ? 'card-publi--picto' : '' }}">
<a href="{{ page_url(publication, "front") }}" class="card-common__wrap">
<div class="card-common__tags {{ templateType == 'picto' ? 'card-common__tags--picto' : '' }}">
<span class="tag">{{ tag }}</span>
{% if publicationProperties.isMemberOnly %}
<span class="tag tag--adherent">
<svg width="10" height="13" class="mr-1 icon--violet">
<use href="#icon-lock" xlink:href="#icon-lock"></use>
</svg>
Adhérent
</span>
{% endif %}
</div>
{% if templateType == 'pic' %}
<picture class="card-common__pic {{ size == 'L' ? 'card-common__pic--publi-L' : 'card-common__pic--publi' }}">
<source media="(max-width:420px)"
data-srcset="{{ cloudinary_media(publicationProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[3][0] ~ ',h_' ~ picSizes[3][1]) }}">
<source media="(max-width:767px)"
data-srcset="{{ cloudinary_media(publicationProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[2][0] ~ ',h_' ~ picSizes[2][1]) }}">
<source width="{{ picSizes[1][0] }}" height="{{ picSizes[1][1] }}" media="(max-width:1023px)"
data-srcset="{{ cloudinary_media(publicationProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[1][0] ~ ',h_' ~ picSizes[1][1]) }}">
<img class="w-full lazyload" width="{{ picSizes[0][0] }}" height="{{ picSizes[0][1] }}"
data-src="{{ cloudinary_media(publicationProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[0][0] ~ ',h_' ~ picSizes[0][1]) }}"
alt="{{ publicationProperties.image.singleMedia.alt }}"/>
</picture>
{% else %}
<div class="card-publi__picto {{ type == 'thematic-brochure' ? 'card-publi__picto--orange' : '' }}">
{% if type == 'thematic-brochure' %}
<svg width="48" height="66" class="mt-8 ml-16">
<use href="#icon-publication-brochure" xlink:href="#icon-publication-brochure"></use>
</svg>
{% else %}
<svg width="78" height="57" class="mt-9 ml-11">
<use href="#icon-publication-guide" xlink:href="#icon-publication-guide"></use>
</svg>
{% endif %}
</div>
{% endif %}
<div class="card-common__inner mt-5">
<div>
<p class="card-common__date {{ templateType == 'pic' ? 'text-grey-dark' : 'text-white' }}">
<svg width="12" height="12"
class="mr-2 {{ type == 'practical-guide' ? 'icon--white' : 'icon--violet' }}">
<use href="#icon-hour" xlink:href="#icon-hour"></use>
</svg>
<span>Publié le <span
class="font-bold {{ templateType == 'pic' ? 'text-violet' : 'text-white' }}">{{ publicationProperties.publicationDate.date|date('d.m.Y') }}</span></span>
</p>
<p class="title-card {{ size == 'L' ? templateType == 'picto' ? 'title-card--XL' : 'title-card--L' : templateType == 'picto' ? 'title-card--L-pic' : '' }} {{ templateType == 'pic' ? 'text-violet' : 'text-white' }} mb-3">
{{ publication.title }}</p>
{% if publication.description is defined and publication.description is not null %}
<div class="card-publi__chapo {{ templateType == 'pic' ? 'text-grey-dark' : 'text-white' }}">
{{ publication.description|striptags|raw }}
</div>
{% endif %}
</div>
<span class="cta-arrow {{ type == 'thematic-brochure' ? 'cta-arrow--circle-violet' : '' }} {{ templateType == 'pic' ? 'text-violet' : 'text-white' }} mt-5">
{{ ctaLabel }}
<span class="cta-arrow__circle">
<svg width="8" height="8" class="icon--white">
<use href="#icon-arrow" xlink:href="#icon-arrow"></use>
</svg>
</span>
</span>
</div>
</a>
{% if publicationProperties.document is defined and publicationProperties.document.singleMedia.publicId is not null %}
{% set isHidden = publicationProperties.isMemberOnly and app.user == null %}
{% if not isHidden %}
<a onclick="gtag('event', 'telecharger-cards', {'button_text': 'telecharger-cards'});" href="{{ cloudinary_media(publicationProperties.document.singleMedia) }}" target="_blank" rel="nofollow"
class="card-common__action {{ type == 'thematic-brochure' ? 'card-common__action--violet' : '' }} icon-center">
<svg width="20" height="20" class="icon--white">
<use href="#icon-download" xlink:href="#icon-download"></use>
</svg>
<span class="sr-only">Télécharger le document</span>
</a>
{% endif %}
{% endif %}
</div>