<?php
/*
template name: front page
*/
get_header();
$slider = get_field('slider');
$empty_sticker = [
'url' => get_template_directory_uri() . '/assets/images/lazyload.png',
'alt' => ''
];
?>
<div class="home-page animation -onload -fade" data-wave="1">
<div class="home-page__backgrounds">
<?php
foreach ($slider as $key => $slide):
?>
<picture>
<source media="(max-width: 1260px)" srcset="<?php echo $slide['background-mob']['url']; ?>">
<img class="<?php echo $key === 0 ? '-active' : ''; ?>" src="<?php echo $slide['background']['url']; ?>" alt="<?php echo $slide['background']['alt']; ?>">
</picture>
<?php endforeach; ?>
</div>
<div class="home-page__wave -odd" data-wave="1">
<div></div>
</div>
<div class="home-page__slides">
<?php
$i = 1;
foreach ($slider as $key => $slide):
$slide_class_name = '';
$wave_id = 1;
if ($i == 2) {
$wave_id = 2;
}
if ($i == 3) {
$i = 0;
$wave_id = 3;
}
if ($key === 0) {
$slide_class_name .= ' -active';
}
if (($key + 1) % 2 === 0) {
$slide_class_name .= ' -even';
} else {
$slide_class_name .= ' -odd';
}
$i++;
?>
<div class="home-page__slide<?php echo $slide_class_name; ?>" data-wave="<?php echo $wave_id; ?>">
<div class="home-page__slide-stickers">
<?php
$stickers = $slide['sticker-list'] ? $slide['sticker-list'] : $empty_sticker;
$stickers_mob = $slide['sticker-list-mob'] ? $slide['sticker-list-mob'] : $empty_sticker;
$sticker_top = $stickers['top'] ? $stickers['top'] : $empty_sticker;
$sticker_center = $stickers['center'] ? $stickers['center'] : $empty_sticker;
$sticker_bottom = $stickers['bottom'] ? $stickers['bottom'] : $empty_sticker;
$sticker_top_mob = $stickers_mob['top'] ? $stickers_mob['top'] : $empty_sticker;
$sticker_center_mob = $stickers_mob['center'] ? $stickers_mob['center'] : $empty_sticker;
$sticker_bottom_mob = $stickers_mob['bottom'] ? $stickers_mob['bottom'] : $empty_sticker;
?>
<div class="home-page__slide-sticker-top">
<picture>
<source media="(max-width: 1260px)" srcset="<?php echo $sticker_top_mob['url']; ?>">
<img src="<?php echo $sticker_top['url']; ?>" alt="<?php echo $sticker_top_mob['alt']; ?>">
</picture>
</div>
<div class="home-page__slide-sticker-center">
<picture>
<source media="(max-width: 1260px)" srcset="<?php echo $sticker_center_mob['url']; ?>">
<img src="<?php echo $sticker_center['url']; ?>" alt="<?php echo $sticker_center_mob['alt']; ?>">
</picture>
</div>
<div class="home-page__slide-sticker-bottom">
<picture>
<source media="(max-width: 1260px)" srcset="<?php echo $sticker_bottom_mob['url']; ?>">
<img src="<?php echo $sticker_bottom['url']; ?>" alt="<?php echo $sticker_bottom_mob['alt']; ?>">
</picture>
</div>
</div>
<div class="container">
<?php if ($key === 0): ?>
<h1 class="title title-1 mob-title-1">
<?php echo $slide['title']; ?>
</h1>
<?php else: ?>
<h2 class="title title-1 mob-title-1">
<?php echo $slide['title']; ?>
</h2>
<?php endif; ?>
<div class="text text-2 mob-text-2">
<p>
<?php echo $slide['text']; ?>
</p>
</div>
<?php
$button = getLink($slide['link']);
if ($button['displayed']):
?>
<div class="button-container">
<a href="<?php echo $button['url']; ?>" class="default-button text-3 mob-text-3 -rectangular">
<?php echo $button['title']; ?>
</a>
</div>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="home-page__footer">
<div class="container">
<div class="home-page__scroll-message text-6 --extrabold --uppercase">
<?php the_field('scroll-message-text'); ?>
</div>
<div class="swiper-pagination"></div>
</div>
</div>
</div>
<?php
get_footer();
?>