{% set size = size ?? 'M' %}
{% set picSizes = [[419, 236], [360, 203], [443, 250], [679, 366], [334,180]] %}
{% if size == 'S' %}
{% set picSizes = [[316, 212], [360, 203], [443, 250], [679, 366], [334, 180]] %}
{% elseif size == 'L' %}
{% set picSizes = [[656, 290], [560, 247], [443, 250], [679, 366], [334, 180]] %}
{% endif %}
{% if type == 'article' %}
{% set ctaLabel = 'Lire l\'actualité' %}
{% set tag = 'Actualité' %}
{% elseif type == 'event' %}
{% set ctaLabel = 'Voir l\'événement' %}
{% set tag = 'événement' %}
{% else %}
{% set ctaLabel = 'Voir l\'événement' %}
{% set tag = 'Agenda CGF' %}
{% endif %}
{% set isArticle = type == 'article' %}
<div class="card-common card-common--{{ size }} card-news-event {{ not isArticle ? 'card-news-event--event' : '' }}">
<a href="{{ page_url(news, "front") }}" class="card-common__wrap">
<div class="card-common__tags">
<span class="tag">{{ tag }}</span>
</div>
<div class="relative {{ not isArticle ? 'mb-1 md:mb-3' : 'card-news-event__top--article' }} card-news-event__top card-news-event__top--{{ size }}">
<picture
class="card-common__pic {{ not isArticle ? 'card-common__pic--news card-common__pic--news-' ~ size : '' }}">
<source media="(max-width:420px)"
data-srcset="{{ cloudinary_media(newsProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[4][0] ~ ',h_' ~ picSizes[4][1]) }} 1x, {{ cloudinary_media(newsProperties.image.singleMedia, 'dpr_2,c_fill,f_auto,q_auto,w_' ~ picSizes[4][0] ~ ',h_' ~ picSizes[4][1]) }} 2x">
<source media="(max-width:767px)"
data-srcset="{{ cloudinary_media(newsProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[3][0] ~ ',h_' ~ picSizes[3][1]) }} 1x, {{ cloudinary_media(newsProperties.image.singleMedia, 'dpr_2,c_fill,f_auto,q_auto,w_' ~ picSizes[3][0] ~ ',h_' ~ picSizes[3][1]) }} 2x">
<source width="{{ picSizes[2][0] }}" height="{{ picSizes[2][1] }}" media="(max-width:1023px)"
data-srcset="{{ cloudinary_media(newsProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[2][0] ~ ',h_' ~ picSizes[2][1]) }} 1x, {{ cloudinary_media(newsProperties.image.singleMedia, 'dpr_2,c_fill,f_auto,q_auto,w_' ~ picSizes[2][0] ~ ',h_' ~ picSizes[2][1]) }} 2x">
<source width="{{ picSizes[1][0] }}" height="{{ picSizes[1][1] }}" media="(max-width:1279px)"
data-srcset="{{ cloudinary_media(newsProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[1][0] ~ ',h_' ~ picSizes[1][1]) }} 1x, {{ cloudinary_media(newsProperties.image.singleMedia, 'dpr_2,c_fill,f_auto,q_auto,w_' ~ picSizes[1][0] ~ ',h_' ~ picSizes[1][1]) }} 2x">
<source media="(min-width:1280px)"
data-srcset="{{ cloudinary_media(newsProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[0][0] ~ ',h_' ~ picSizes[0][1]) }} 1x, {{ cloudinary_media(newsProperties.image.singleMedia, 'dpr_2,c_fill,f_auto,q_auto,w_' ~ picSizes[0][0] ~ ',h_' ~ picSizes[0][1]) }} 2x">
<img class="w-full lazyload" width="{{ picSizes[0][0] }}" height="{{ picSizes[0][1] }}"
data-src="{{ cloudinary_media(newsProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[0][0] ~ ',h_' ~ picSizes[0][1]) }}"
alt="{{ newsProperties.image.singleMedia.alt }}"/>
</picture>
{% if not isArticle %}
<div class="card-news-event__date card-news-event__date--{{ size }}">
<span>{{ newsProperties.startEventDate.date|date("d.m") }}</span>
{% if newsProperties.endEventDate is defined and newsProperties.endEventDate is not empty %}
<span>{{ newsProperties.endEventDate.date|date("d.m") }}</span>
<span class="year">{{ newsProperties.endEventDate.date|date("Y") }}</span>
{% else %}
<span class="year">{{ newsProperties.startEventDate.date|date("Y") }}</span>
{% endif %}
</div>
{% endif %}
</div>
<div class="card-common__inner {{ size == 'S' ? 'card-common__inner--S' : '' }} mt-5">
<div>
{% if isArticle %}
<p class="card-common__date text-grey-dark">
<svg width="12" height="12" class="mr-2 icon--violet">
<use href="#icon-hour" xlink:href="#icon-hour"></use>
</svg>
<span>Publié le <span
class="font-bold text-violet">{{ newsProperties.publicationDate.date|date("d.m.Y") }}</span></span>
</p>
{% endif %}
<p class="title-card title-card--{{ size }} {{ isArticle ? 'text-violet' : 'text-white' }} mb-3">
{{ news.title }}
</p>
{% if isArticle %}
{% if news.description is defined and news.description is not null %}
<div class="card-publi__chapo">
{{ news.description|striptags|raw }}
</div>
{% endif %}
{% else %}
{% if newsProperties.place is defined and newsProperties.place is not null %}
<div class="flex card-news-event__location">
<svg width="14" height="20" class="mr-2 icon--orange flex-shrink-0">
<use href="#icon-pin" xlink:href="#icon-pin"></use>
</svg>
{{ newsProperties.place }}
</div>
{% endif %}
{% endif %}
</div>
<span class="cta-arrow {{ isArticle ? '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 not isArticle %}
{% if newsProperties.registerLink is defined and newsProperties.registerLink is not null %}
<a href="{{ newsProperties.registerLink }}" target="_blank" rel="nofollow" class="card-common__action icon-center">
<svg width="20" height="18" class="icon--white">
<use href="#icon-calendar" xlink:href="#icon-calendar"></use>
</svg>
<span class="sr-only">S'inscrire à l'évènement</span>
</a>
{% endif %}
{% endif %}
</div>