custom/static-plugins/NdTheme/src/Resources/views/storefront/element/cms-element-thumbnail-slider.html.twig line 1

Open in your IDE?
  1. {# Slider element is developed by no.dots #}
  2. {% block nd_cms_element_slider_container %}
  3.     {% block nd_cms_element_slider_container_slider_settings %}
  4.         {% if element.config.active.value %}
  5.             {% set slick_settings_modal = {
  6.                 "slidesToShow": 1,
  7.                 "infinite": false,
  8.                 "arrows":true,
  9.                 "prevArrow": "#prev-slide-"~element.id,
  10.                 "nextArrow": "#next-slide-"~element.id,
  11.                 "responsive": [
  12.                     {
  13.                         "breakpoint": 400,
  14.                         "settings": "unslick"
  15.                     },
  16.                     {
  17.                         "breakpoint": 769,
  18.                         "settings": {
  19.                         "slidesToShow": 4,
  20.                     }
  21.                     },
  22.                     {
  23.                         "breakpoint": 1000,
  24.                         "settings": {
  25.                         "slidesToShow": 4,
  26.                     }
  27.                     },
  28.                     {
  29.                         "breakpoint": 500,
  30.                         "settings": "unslick"
  31.                     }
  32.                 ]
  33.             } %}
  34.         {% else %}
  35.             {% set slick_settings_modal = {
  36.                 "slidesToShow": 1,
  37.                 "mobileFirst": true,
  38.                 "infinite": false,
  39.                 "arrows":true,
  40.                 "prevArrow": "#prev-slide-"~element.id,
  41.                 "nextArrow": "#next-slide-"~element.id,
  42.                 "responsive": [
  43.                     {
  44.                         "breakpoint": 400,
  45.                         "settings": {
  46.                         "slidesToShow": 3,
  47.                         "arrows":true,
  48.                         "prevArrow": "#prev-slide-"~element.id,
  49.                         "nextArrow": "#next-slide-"~element.id,
  50.                     }
  51.                     },
  52.                     {
  53.                         "breakpoint": 769,
  54.                         "settings": {
  55.                         "slidesToShow": 5,
  56.                         "arrows":true,
  57.                         "prevArrow": "#prev-slide-"~element.id,
  58.                         "nextArrow": "#next-slide-"~element.id,
  59.                     }
  60.                     },
  61.                     {
  62.                         "breakpoint": 1000,
  63.                         "settings": {
  64.                         "slidesToShow": 5,
  65.                         "arrows":true,
  66.                         "prevArrow": "#prev-slide-"~element.id,
  67.                         "nextArrow": "#next-slide-"~element.id,
  68.                     }
  69.                     },
  70.                     {
  71.                         "breakpoint": 500,
  72.                         "settings": {
  73.                         "slidesToShow": 4,
  74.                         "arrows":true,
  75.                         "prevArrow": "#prev-slide-"~element.id,
  76.                         "nextArrow": "#next-slide-"~element.id,
  77.                     }
  78.                     }
  79.                 ]
  80.             } %}
  81.         {% endif %}
  82.         <section class="hero-carousel">
  83.         <div class="page-max-width">
  84.         <div class="wrapper relative">
  85.         <div class="w-full text-center mb-4 md:mb-10 h1">
  86.             <h1>{{ element.config.title.value }}</h1>
  87.         </div>
  88.         <div class="slick-thumbnail slick-init flex flex-row space-x-8 justify-center items-center"
  89.              data-slick='{{ slick_settings_modal|json_encode }}'>
  90.             {% for key, slide in element.data.get('slides') %}
  91.                 <div class="flex flex-col justify-center items-center">
  92.                     <div>
  93.                         {# CHECK if desktop image exists, use two square blocks if it exists. If not, use a single 16x9 image #}
  94.                         <div class="inset-0">
  95.                             {% if slide.mobile_image %}
  96.                                 <div class="w-28 h-28 lg:h-40 lg:w-40 mx-auto">
  97.                                     {% sw_thumbnails 'cms-image-thumbnails' with {
  98.                                         media: slide.mobile_image,
  99.                                         load: true,
  100.                                         attributes: {
  101.                                             'class': 'rounded-full w-full h-full object-cover object-center',
  102.                                             'alt': (slide.mobile_image.translated.alt ?: ''),
  103.                                             'title': (slide.mobile_image.translated.title ?: '')
  104.                                         }
  105.                                     } %}
  106.                                 </div>
  107.                             {% endif %}
  108.                         </div>
  109.                         <div class="container text-black z-10 text-center">
  110.                             {% if slide.text %}
  111.                                 <div class="hidden md:block font-bold my-4 break-all">
  112.                                     {{ slide.text }}
  113.                                 </div>
  114.                             {% endif %}
  115.                             {% if slide.mobileText %}
  116.                                 <div class="md:hidden font-bold my-4 break-all">
  117.                                     {{ slide.mobileText }}
  118.                                 </div>
  119.                             {% endif %}
  120.                         </div>
  121.                     </div>
  122.                 </div>
  123.             {% endfor %}
  124.         </div>
  125.     {% endblock %}
  126.     {% block nd_cms_element_slider_container_buttons %}
  127.         <div class="flex grid-gap-2 justify-end mr-2 lg:mr-6 xl:mr-6 2xl:mr-10">
  128.             {% block  nd_cms_element_slider_container_buttons_prev %}
  129.                 <button id="prev-slide-{{ element.id }}"
  130.                         class="products-back flex p-1 text-white transition duration-300 active:-translate-x-0.5 hover:-translate-x-0.5">
  131.                     {% sw_icon 'arrow-left' style{ 'pack': 'default', 'class': 'full-size w-8' } %}
  132.                 </button>
  133.             {% endblock %}
  134.             {% block  nd_cms_element_slider_container_buttons_next %}
  135.                 <button id="next-slide-{{ element.id }}"
  136.                         class="products-next flex p-1 text-white transition duration-300 active:translate-x-0.5 hover:translate-x-0.5">
  137.                     {% sw_icon 'arrow-right' style{ 'pack': 'default', 'class': ' full-size w-8' } %}
  138.                 </button>
  139.             {% endblock %}
  140.         </div>
  141.     {% endblock %}
  142.     </div>
  143.     </div>
  144.     </section>
  145. {% endblock %}