blocks/MarqueeBlock/block.html.twig line 1

Open in your IDE?
  1. {% if data.activado|default == true %}
  2.     <section id="{{ id }}"
  3.              class="{{ className }}{% if className == 'MarqueeBlock alignfull' %} my-10 md:my-16 {% endif %} relative not-prose {% if data.background|default == "primary" %} bg-primary {% elseif data.background|default == "secondary" %} bg-secondary {% elseif data.background|default == "black" %} bg-[#000000] {% elseif data.background|default == "white" %} bg-white {% endif %} border-b border-gray-200/50 overflow-hidden h-auto w-auto py-3 flex items-center">
  4.         <div class="relative flex flex-col lg:flex-row lg:items-center gap-0 lg:gap-8 w-full overflow-hidden justify-center {% if data.efect|default == 'transition' and data.text_align|default == "left" or data.text_align|default == "center" and not data.efect|default == 'motion' %} lg:px-20 px-5 max-w-screen-2xl mx-auto {% endif %}">
  5.             <div class="w-full whitespace-normal flex {% if data.efect|default == 'motion' %} gap-x-8 moving-text {% endif %}">
  6.                 {% set messageIndex = 0 %}
  7.                 {% if data.efect|default == 'transition' %}
  8.                     {% for item in data.mensajes %}
  9.                         <div class="flex items-center gap-2.5 w-full {% if data.efect|default == 'transition' %} marquee-item-transition flex-shrink-0 opacity-0 transition-opacity duration-500 ease-in-out absolute inset-x-0 {% if messageIndex == 0 %} active {% else %} invisible {% endif %} {% elseif data.efect|default == 'motion' %} moving-item {% endif %} {% if data.efect|default == 'transition' and data.text_align|default == "center" %} justify-center text-center flex-wrap {% endif %} relative shrink-0"
  10.                              data-index="{{ messageIndex }}">
  11.                             {% if item.icono|default %}
  12.                                 <img {{ wordpress_image_attrs(item.icono, 'blocks', 'presentation') }}
  13.                                         loading="lazy" class="h-auto w-[24px]">
  14.                             {% endif %}
  15.                             {% if item.texto|default %}
  16.                                 <span class="text-xs lg:text-sm font-title {% if data.background|default == "white" %} text-black {% else %} text-white {% endif %} !leading-snug {% if data.efect|default == 'transition' and data.text_align|default == "center" %} w-auto {% endif %}">{{ item.texto|raw }}</span>
  17.                             {% endif %}
  18.                             {% if item.boton.url|default %}
  19.                                 <a href="{{ item.boton.url }}"
  20.                                    target="{{ item.boton.target }}"
  21.                                    class="absolute inset-0 w-full h-full"></a>
  22.                             {% endif %}
  23.                         </div>
  24.                         {% set messageIndex = messageIndex + 1 %}
  25.                     {% endfor %}
  26.                 {% endif %}
  27.                 {% if data.efect|default == 'motion' %}
  28.                     <div class="swiper">
  29.                         <div class="swiper-wrapper">
  30.                             {% for i in 0..10 %}
  31.                                 {% for item in data.mensajes %}
  32.                                     <div class="swiper-slide mr-8 inline-flex items-center">
  33.                                         {% if item.icono|default %}
  34.                                             <div class="flex-shrink-0 mr-2">
  35.                                                 <img {{ wordpress_image_attrs(item.icono, 'blocks', 'presentation') }}
  36.                                                         loading="lazy"
  37.                                                         class="h-auto w-6">
  38.                                             </div>
  39.                                         {% endif %}
  40.                                         {% if item.texto|default %}
  41.                                             <span class="text-xs lg:text-sm font-title {% if data.background|default == "white" %} text-black {% else %} text-white {% endif %} !leading-snug whitespace-nowrap">
  42.                                         {{ item.texto|raw }}
  43.                                     </span>
  44.                                         {% endif %}
  45.                                         {% if item.boton.url|default %}
  46.                                             <a href="{{ item.boton.url }}"
  47.                                                target="{{ item.boton.target }}"
  48.                                                class="absolute inset-0 w-full h-full z-10">
  49.                                             </a>
  50.                                         {% endif %}
  51.                                     </div>
  52.                                 {% endfor %}
  53.                             {% endfor %}
  54.                         </div>
  55.                     </div>
  56.                 {% endif %}
  57.             </div>
  58.         </div>
  59.     </section>
  60. {% endif %}
  61. <style>
  62.     {{ style|raw }}
  63.     .w-full.whitespace-normal {
  64.         position: relative;
  65.     }
  66.     /*efecto transicion*/
  67.     .marquee-item-transition {
  68.         flex-shrink: 0;
  69.         position: absolute;
  70.         width: 100%;
  71.         left: 0;
  72.         right: 0;
  73.         transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out;
  74.         transform: translateY(30px);
  75.         opacity: 0;
  76.     }
  77.     .marquee-item-transition.active {
  78.         transform: translateY(0);
  79.         opacity: 1;
  80.         position: relative;
  81.     }
  82.     .marquee-item-transition.prev {
  83.         transform: translateY(-30px);
  84.         opacity: 0;
  85.         position: absolute;
  86.         top: 0;
  87.     }
  88.     /*efecto movimiento*/
  89.     .MarqueeBlock .swiper-wrapper {
  90.         will-change: transform;
  91.         backface-visibility: hidden;
  92.         transform-style: preserve-3d;
  93.     }
  94.     .MarqueeBlock .swiper-slide {
  95.         width: auto !important;
  96.         flex-shrink: 0;
  97.         backface-visibility: hidden;
  98.         transform-style: preserve-3d;
  99.     }
  100.     .marquee span {
  101.         text-align: center;
  102.         white-space: nowrap;
  103.         line-height: 1.2;
  104.     }
  105. </style>