{%- set class_name = [
"i-gallery-slide",
"u-posr",
]|join(' ')|trim -%}
{%- set attrs = [
'class="' ~ class_name ~ '"',
] -%}
{%- set attrs = attrs|join(' ')|trim -%}
{% if props.size == "large" %}
{%- set tag = "button" -%}
{% else %}
{%- set tag = "a" -%}
{% endif %}
{% set img = props.size == "large" ? props.large_img : props.img %}
{%- set item_class_name = [
"i-gallery-slide__link",
"d-block",
]|join(' ')|trim -%}
{%- set item_attrs = [
'class="' ~ item_class_name ~ '"',
] -%}
{%- if tag == "button" %}
{%- set item_attrs = item_attrs|merge(['type="button"']) -%}
{%- endif -%}
{%- if tag == "a" %}
{%- set item_attrs = item_attrs|merge(['data-fancybox="' ~ props.img.data_fancybox ~ '"']) -%}
{%- endif -%}
{% if tag == "a" and props.img.href %}
{%- set item_attrs = item_attrs|merge(['href="' ~ props.img.href ~ '"']) -%}
{% endif %}
{% if tag == "a" and not props.img.href %}
{%- set item_attrs = item_attrs|merge(['href="' ~ base_path ~ "images/content/placeholder.png" ~ '"']) -%}
{% endif %}
{%- set item_attrs = item_attrs|join(' ')|trim -%}
{% set img_props = {
objectfit: "contain",
alt: props.img.alt|default(props.title),
is_placeholder: false,
ratio:"1-1",
native_lazyload: true,
} %}
<div {{ attrs|raw }}>
<div class="i-gallery-slide__image">
<{{tag}} {{ item_attrs|raw }}>
{% if img %}
{% include "@Components/img/img.twig" with {props: img|merge(img_props)} %}
{% else %}
{% include "@Components/img/img.twig" with {props: img_props|merge({
src: base_path ~ "images/content/placeholder.png",
})} %}
{% endif %}
</{{tag}}>
{% if props.tag and props.size == "large" %}
{% include "@Components/items/tag-item/tag-item.twig" with {props: {
title: props.tag.title,
size: "sm-base",
variant: "product",
extra_class: "i-gallery-slide__tag u-posa"
}} %}
{% endif %}
</div>
</div>