{% if file is not defined %}
{% set file = block.file %}
{% endif %}
<div class="document dflex jcc aic br8 mt-24px">
{% if file.formats|length > 0 %}
<img src="{{ file.formats['600x.webp'] }}" srcset="{{ file.formats['300x.webp'] }} 300w, {{ file.formats['600x.webp'] }} 600w, {{ file.formats['1000x.webp'] }} 1000w" sizes="600px" alt="Document" loading="lazy" width="640" height="294">
{% else %}
{% set extension = file.fileVersion.name|split('.')|last %}
{% set previewPath = (extension == 'ppt' or extension == 'pptx') ? '/resources/img/preview-media/visuel_ppt.jpg' : '/resources/img/preview-media/preview_media_link.png' %}
<img src="{{ previewPath }}" alt="Preview">
{% endif %}
<a href="{{ file.url }}" class="CTA nodeco fw600 dflex aic fs18 lh28 br6">{{ source('svg/download-icon.html.twig') }}Téléchargez le document</a>
</div>