{% set is_video = props.video.src ? true : false %}
{% set is_product = props.variant == "product" ? true : false %}
{%- set class_name = [
"i-media",
"u-posr",
is_video ? "--video u-img-hover" : null,
is_product ? "--product" : null
]|join(' ')|trim -%}
{%- set attrs = [
'class="' ~ class_name ~ '"',
] -%}
{%- if is_video %}
{%- set attrs = attrs|merge(['data-fancybox data-src="' ~ props.video.src ~ '"']) -%}
{%- endif -%}
{%- set attrs = attrs|join(' ')|trim -%}
{% set img_props = {
width: is_product ? 656 : 568,
height: is_product ? 656 : 568,
objectfit: is_product ? "contain" : "cover",
is_placeholder: true,
ratio: "1-1",
} %}
<div {{ attrs|raw }}>
{% if props.img %}
{% include "@Components/img/img.twig" with {props: props.img|merge(img_props)} %}
{% else %}
{% include "@Components/img/img.twig" with {props: {
src: base_path ~ "images/content/placeholder.png",
}|merge(img_props)} %}
{% endif %}
{% if is_video %}
<div class="i-media__play-icon u-posa u-top-50-p u-left-50-p u-translate-middle">
{% include "@Components/icon/icon.twig" with {props: {
src: "@Images/svg/play.svg",
size: "xxl",
color: "primary",
}} %}
</div>
{% endif %}
{% if props.tag and is_product %}
{% include "@Components/items/tag-item/tag-item.twig" with {props: {
title: props.tag.title,
size: "sm-base",
variant: "product",
extra_class: "i-media__tag u-posa"
}} %}
{% endif %}
</div>