stack/src/components/items/product-item/product-item.twig line 1

Open in your IDE?
  1. {%- set class_name = [
  2.   "i-product",
  3.   "d-flex flex-column gap-2 p-2 u-posr h-100 u-bg-white",
  4.   props.extra_class|default(false) ? props.extra_class : null,
  5. ]|join(' ')|trim -%}
  6. {%- set attrs = [
  7.   'class="' ~ class_name ~ '"',
  8. ] -%}
  9. {% if props.id %}
  10.   {%- set attrs = attrs|merge(['id="' ~ props.id ~ '"']) -%}
  11. {% endif %}
  12. {%- set attrs = attrs|join(' ')|trim -%}
  13. {% set detail_button = {
  14.   title: "Detail produktu"|trans,
  15.   url: props.url,
  16.   onclick: props.onclick,
  17.   tag: 'button',
  18.   icon: {
  19.     src: "@Images/svg/chevron-right.svg",
  20.     size: "lg"
  21.   },
  22.   full_width: true
  23. } %}
  24. {% set img_props = {
  25.   is_placeholder: true,
  26.   ratio: "1-1",
  27.   objectfit: "contain",
  28.   width: 296,
  29.   height: 296,
  30.   alt: props.img.alt|default(props.title|default(""))|escape,
  31. } %}
  32. <article {{ attrs|raw }}>
  33.   <figure class="i-product__image d-block u-posr">
  34.     <a style="cursor:pointer;" onclick="{{ props.onclick }}" class="i-product__image-link d-flex align-items-center" title="{{ props.title }}">
  35.       {% if props.img %}
  36.         {% include "@Components/img/img.twig" with {props: props.img|merge(img_props)|merge({
  37.           extra_class: "i-product__image"
  38.         })} %}
  39.       {% else %}
  40.         {% include "@Components/img/img.twig" with {props: img_props|merge({
  41.           src: base_path ~ "images/content/placeholder.png",
  42.           extra_class: "i-product__image-placeholder"
  43.         })} %}
  44.       {% endif %}
  45.     </a>
  46.     {% if props.tag %}
  47.       {% include "@Components/items/tag-item/tag-item.twig" with {props: {
  48.         title: props.tag.title,
  49.         size: "sm-base",
  50.         variant: "product",
  51.         extra_class: "i-product__tag u-posa u-z-index-3"
  52.       }} %}
  53.     {% endif %}
  54.   </figure>
  55.   <div class="i-product__wrap d-flex flex-column gap-4">
  56.     <div class="i-product__header d-flex flex-column gap-1 px-1">
  57.       <h5 class="i-product__title u-fz-lg u-fw-500">
  58.         {% include "@Components/link/link.twig" with {props: {
  59.           color: "primary-to-conversion",
  60.           title: props.title,
  61.           onclick: props.onclick,
  62.           extra_class: "i-product__link u-clamp",
  63.         }} %}
  64.       </h5>
  65.       {% if props.family %}
  66.         <div class="i-product__family d-flex flex-wrap gap-1 u-color-primary-500 u-fz-sm u-fw-600">
  67.           <div class="u-color-primary-300 u-fw-400">{{ "Rodina:"|trans }}</div>
  68.           {{ props.family }}
  69.         </div>
  70.       {% endif %}
  71.     </div>
  72.     <div class="i-product__content d-flex flex-column gap-2 u-posr">
  73.       {% if props.code %}
  74.         <div class="i-product__code d-flex flex-wrap gap-1 u-color-primary-500 u-fz-sm u-fw-600 px-1">
  75.           <div class="u-color-primary-300 u-fw-400 me-3">{{ "Kód:"|trans }}</div>
  76.           {{ props.code }}
  77.         </div>
  78.       {% endif %}
  79.       {% if props.specs %}
  80.         <div class="i-product__specs d-flex flex-wrap px-1">
  81.           {% for item in props.specs %}
  82.             {% include "@Components/items/tooltip-item/tooltip-item.twig" with {props: item.tooltip|merge({
  83.               extra_class: "i-product__tooltip"
  84.             })} %}
  85.           {% endfor %}
  86.         </div>
  87.       {% endif %}
  88.     </div>
  89.   </div>
  90.   <div class="i-product__detail-btn mt-auto w-100">
  91.     {% include "@Components/button/button.twig" with {props: detail_button} %}
  92.   </div>
  93. </article>