{% set banners = get_banners_by_zone(block.bannerZone) %}
<section class="main-block home-welcome home-section is-light" data-load-gallery="true" data-gallery-delay="5"
data-fullpage-scroll="1">
<div class="home-welcome--bg">
{% for banner in banners %}
{% if banner.creativity is defined and banner.creativity is not null %}
{% set creativity = banner.creativity %}
{% else %}
{% set creativity = banner.creativity %}
{% endif %}
{% if banner.creativityMobile is defined and banner.creativityMobile is not null %}
{% set creativityMobile = banner.creativityMobile %}
{% else %}
{% set creativityMobile = creativity %}
{% endif %}
{% if banner.creativityTablet is defined and banner.creativityTablet is not null %}
{% set creativityTablet = banner.creativityTablet %}
{% else %}
{% set creativityTablet = creativity %}
{% endif %}
{% if creativity is youtubeVideo %}
{% if not is_mobile() and not is_tablet() %}
<div class="js-home-welcome--bg-item home-welcome--bg-item has-video" data-time="{{ banner.time }}">
<video id="video-welcome-{{ loop.index0 }}"
preload
autoplay
class="js-responsive-video preload-video"
data-desktop=""
data-tablet="{{ creativityTablet | resize(900)|file_url }}"
data-mobile="{{ creativityMobile | resize(700)|file_url }}"
controls="false"
muted
data-setup='{"techOrder": ["youtube"], "sources": [{ "type": "video/youtube", "src": "{{ 'https://www.youtube.com/watch?v='~creativity.reference }}"}] }'
>
</video>
</div>
{% else %}
{% if is_mobile() %}
{% set alternateCreativityForVideo = creativityMobile %}
{% endif %}
{% if is_tablet() %}
{% set alternateCreativityForVideo = creativityTablet %}
{% endif %}
{% set mobilePicture = false %}
{% if banner.creativityMobile %}
{% set mobilePicture = picture_data(creativityMobile, 700) | json_decode %}
{% endif %}
{% set tabletPicture = false %}
{% if banner.creativityTablet %}
{% set mobilePicture = picture_data(creativityTablet, 700) | json_decode %}
{% endif %}
<div class="js-home-welcome--bg-item home-welcome--bg-item" data-time="{{ banner.time }}">
<div class="home-welcome--bg-image js-responsive-image"
data-desktop="{{ alternateCreativityForVideo | resize(1920)|file_url }}"
data-tablet="{{ tabletPicture ? tabletPicture.url : creativityTablet | resize(900)|file_url }}"
data-mobile="{{ mobilePicture ? mobilePicture.url : creativityMobile | resize(700)|file_url }}">
</div>
</div>
{% endif %}
{% else %}
<div class="js-home-welcome--bg-item home-welcome--bg-item" data-time="{{ banner.time }}">
<div class="home-welcome--bg-image">
<picture-component class="js-picture-component"
:image="{{ picture_data(creativityMobile, null, null, null, [{'file': creativity, 'width': 1920, 'min': 960}, {'file': creativityTablet, 'width': 900, 'min': 600}]) }}">
</picture-component>
</div>
</div>
{% endif %}
{% endfor %}
</div>
{% for banner in banners %}
{% if banner.creativity is defined and banner.creativity is not null %}
{% set creativity = banner.creativity %}
{% else %}
{% set creativity = banner.creativity %}
{% endif %}
<div class="home-welcome--item {{ loop.index == 1 ? 'is-active': '' }} banner-{{ loop.index }}" data-time="{{ banner.time }}">
<div class="container">
<div class="main-content position-relative {% if banner.textWhite %}is-text--white{% endif %}">
<div class="main-content--title title-l title-l {% if creativity is youtubeVideo %}is-video{% endif %}">{{ banner.text | raw }}</div>
<div class="main-content--text {% if creativity is youtubeVideo %}is-video{% endif %}">{{ banner.author | raw }}</div>
{% if banner.showCta %}
<a class="main-content--cta button white" href="{{ banner.link == null ? path(banner.route) : banner.link }}" {% if banner.openNewWindow %} target="_blank" {% endif %}>
<span>{{ banner.linkName }}</span>
</a>
{% endif %}
{{ full_admin_edit(banner, 'edit', {}, 'banner-'~loop.index~ 'icon-edit-inline', '', 'esi' ) }}
</div>
</div>
</div>
{% endfor %}
<div class="slider-progress">
<div class="progress"></div>
</div>
<div class="home-welcome-buttons">
<div class="home-welcome-buttons--left">
{% include 'partials/global/svg/angle-left.svg.twig' %}
</div>
<div class="home-welcome-buttons--right">
{% include 'partials/global/svg/angle-right.svg.twig' %}
</div>
</div>
<ol class="flickity-page-dots">
</ol>
</section>