{% if resources|length > 0 %}
<div class="before-after-items">
{% set id = app.request.query.get('id') %}
{% set targetIndex = -1 %}
{% for index, article in resources %}
{% if article.id == id %}
{% set targetIndex = index %}
{% endif %}
{% endfor %}
{% if targetIndex >= 0 %}
{% set previousIndex = targetIndex - 1 %}
{% set nextIndex = targetIndex + 1 %}
{% if previousIndex >= 0 %}
{% set previousArticle = resources|slice(previousIndex, 1)|first %}
<div class="previous-article">
<a class="" href="{{ path('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : previousArticle.slug}) }}">
{% if previousArticle.images|length > 0 %}
<div class="image">
<img src="{{ previousArticle.images[0].path|imagine_filter(filter|default('sylius_small')) }}" alt="{{ previousArticle.images[0].path }}">
</div>
{% endif %}
</a>
<div class="link-before-after">
<span>
<a href="{{ path('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : previousArticle.slug}) }}" data-disqus-identifier="{{ url('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : previousArticle.slug}) }}">
<svg width="8" height="15" viewBox="0 0 8 15" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.66667 14.1666L0 7.49992L6.66667 0.833252L7.85 2.01659L2.36667 7.49992L7.85 12.9833L6.66667 14.1666Z" fill="#858585"/>
</svg>
Précédent
</a>
</span>
<h3>
<a href="{{ path('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : previousArticle.slug}) }}">{{ previousArticle.translations['fr_FR'].title }}</a>
</h3>
</div>
</div>
{% endif %}
{% if previousIndex >= 0 and nextIndex < articles|length%}
<script>
console.log('previousIndex');
</script>
<style>
@media only screen and (max-width: 768px) {
.previous-article {
display: none !important;
}
}
</style>
{% endif %}
{% if nextIndex < articles|length %}
{% set nextArticle = resources|slice(nextIndex, 1)|first %}
<div class="next-article">
<div class="link-before-after">
<span>
<a href="{{ path('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : nextArticle.slug}) }}" data-disqus-identifier="{{ url('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : nextArticle.slug}) }}">
Suivant
<svg width="9" height="15" viewBox="0 0 9 15" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.35033 14.1666L0.166992 12.9833L5.65033 7.49992L0.166992 2.01659L1.35033 0.833252L8.01699 7.49992L1.35033 14.1666Z" fill="#858585"/>
</svg>
</a>
</span>
<h3>
<a href="{{ path('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : nextArticle.slug}) }}">{{ nextArticle.translations['fr_FR'].title }}</a>
</h3>
</div>
<a class="" href="{{ path('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : nextArticle.slug}) }}">
{% if nextArticle.images|length > 0 %}
<div class="image">
<img src="{{ nextArticle.images[0].path|imagine_filter(filter|default('sylius_small')) }}" alt="{{ nextArticle.images[0].path }}">
</div>
{% endif %}
</a>
</div>
{% endif %}
{% endif %}
</div>
<style>
/*.before-after-items{*/
/* display: flex;*/
/* flex-direction: row;*/
/* justify-content: space-between;*/
/* padding-top: 4rem;*/
/*}*/
/*.before-after-items > * {*/
/* display: flex;*/
/* flex-direction: row;*/
/* align-items: center;*/
/* gap: 1rem;*/
/*}*/
/*.before-after-items > * > .link-before-after {*/
/* display: flex;*/
/* flex-direction: column;*/
/* gap: 0.5rem;*/
/* align-items: start;*/
/*}*/
/*.before-after-items > * > .link-before-after > span > a {*/
/* display: flex;*/
/* flex-direction: row;*/
/* gap: 0.5rem;*/
/* align-items: center;*/
/* color: #858585;*/
/*}*/
/*.before-after-items > * > .link-before-after > h3 {*/
/* margin: 0 !important;*/
/*}*/
/*.next-article{*/
/* margin-left: auto;*/
/*}*/
</style>
{% endif %}