{#
Required vars: currentMedia, currentMediaUrl, mediaType
#}
{% set svgLinkIcon %}
  {% include '@AutoAdminMedia/Form/icon/link_icon.svg' %}
{% endset %}
{% set svgMissingMediaIcon %}
  {% include '@AutoAdminMedia/Form/icon/missing_media.svg' %}
{% endset %}
<div class="preview {% if currentMedia|default() is empty %}missing-media{% endif %}">
  <div class="preview-wrap">
    {% if mediaType|slice(0,5)|default() == 'image'
      or mediaType|slice(0,6)|default() == 'image_'
      or mediaType|slice(0,13)|default() == 'private_image'
      or mediaType|slice(0,14)|default() == 'private_image_'
    %}
      <img class="preview-el" src="{{ currentMediaUrl|default() }}" title="{{ currentMedia.currentTranslation.fileName }}"/>
    {% elseif mediaType|default() == 'file' %}
      <a class="preview-el" href="{{ currentMediaUrl|default() }}" target="_blank">
        <i class="fa-light fa-file"></i> {{ currentMedia.currentTranslation.fileName }}
      </a>
    {% endif %}
    <div class="no-media-icon">{{ svgMissingMediaIcon }}</div>
    {% if currentMediaUrl|default() is not empty %}
      <a href="{{ currentMediaUrl|default() }}"
         target="_blank"
         class="media-link"
         title="Voir en ligne"
      >{{ svgLinkIcon|default()|raw }} {{ currentMedia.currentTranslation.fileName|default() }}</a>
    {% endif %}
  </div>
</div>