templates/_snippets/partners_companies.html.twig line 1

Open in your IDE?
  1. {#
  2. SNIPPET CANONIQUE
  3. - Type Sulu: partners_companies
  4. #}
  5. {# Valeurs de base #}
  6. {% set effectiveSectionSettings = showSectionSettings|default(true) ? sectionSettings|default({}) : {} %}
  7. {% set content = effectiveSectionSettings|merge(partnersCompanies) %}
  8. {% set companies = partners_snippet_companies() %}
  9. {% set datas = {} %}
  10. {% if content is defined and content is not none and content is not empty %}
  11. {# Propriétés de la section #}
  12. {% set datas = datas|merge({'section': section(content)}) %}
  13. {# Propriétés du titre #}
  14. {% set datas = datas|merge({'title': title(content)}) %}
  15. {# Mise à jour du CSS lié à la section #}
  16. <style>
  17. {% include '_snippets/components/_section.html.twig' %}{% include '_snippets/components/_title.html.twig' %}/* ========================================
  18. PARTNERS COMPANIES MARQUEE STYLES
  19. ======================================== */
  20. .partners-companies {
  21. width: 100%;
  22. overflow: hidden;
  23. position: relative;
  24. }
  25. .partners-companies .marquee {
  26. display: flex;
  27. white-space: nowrap;
  28. position: relative;
  29. width: fit-content;
  30. will-change: transform;
  31. align-items: center;
  32. gap: {{content.marqueeGap|default(40)}}
  33. {{content.marqueeGapUnit|default('px')}};
  34. }
  35. .partners-companies .marquee .company-logo {
  36. display: inline-flex;
  37. align-items: center;
  38. justify-content: center;
  39. flex-shrink: 0;
  40. position: relative;
  41. height: {{content.marqueeHeight|default(90)}}
  42. {{content.marqueeHeightUnit|default('px')}};
  43. min-width: 120px;
  44. max-width: 200px;
  45. overflow: visible;
  46. }
  47. .partners-companies .marquee .company-logo img {
  48. height: {{content.marqueeHeight|default(90) ~ content.marqueeHeightUnit|default('px')}};
  49. width: auto;
  50. max-width: 100%;
  51. object-fit: contain;
  52. transition: 0.3s ease-in-out;
  53. display: block;
  54. filter:{{content.isBlackAndWhite|default(false) ? 'grayscale(100%)' : 'grayscale(0%)'}}
  55. ;
  56. }
  57. .partners-companies .marquee .company-logo a {
  58. display: flex;
  59. align-items: center;
  60. justify-content: center;
  61. height: 100%;
  62. width: 100%;
  63. overflow: visible;
  64. }
  65. .partners-companies .marquee .company-logo img {
  66. transform: scale(0.95);
  67. }
  68. .partners-companies .marquee .company-logo:hover img {
  69. transform: scale(1);
  70. filter:{{content.isBlackAndWhite|default(false) ? 'grayscale(0%)' : 'unset'}}
  71. ;
  72. }
  73. /* Responsive */
  74. @media(max-width: 768px) {
  75. .partners-companies .marquee .company-logo {
  76. height: {{(content.marqueeHeight|default(90) * 0.8)|round}}
  77. {{content.marqueeHeightUnit|default('px')}};
  78. min-width: 100px;
  79. max-width: 150px;
  80. margin-right: {{(content.marqueeGap|default(40) * 0.75)|round}}
  81. {{content.marqueeGapUnit|default('px')}};
  82. overflow: visible;
  83. }
  84. .partners-companies .marquee .company-logo img {
  85. height: {{(content.marqueeHeight|default(90) * 0.8)|round}}
  86. {{content.marqueeHeightUnit|default('px')}};
  87. }
  88. .partners-companies .marquee .company-logo a {
  89. overflow: visible;
  90. }
  91. }
  92. @media(max-width: 480px) {
  93. .partners-companies .marquee .company-logo {
  94. height: {{(content.marqueeHeight|default(90) * 0.6)|round}}
  95. {{content.marqueeHeightUnit|default('px')}};
  96. min-width: 80px;
  97. max-width: 120px;
  98. margin-right: {{(content.marqueeGap|default(40) * 0.5)|round}}
  99. {{content.marqueeGapUnit|default('px')}};
  100. overflow: visible;
  101. }
  102. .partners-companies .marquee .company-logo img {
  103. height: {{(content.marqueeHeight|default(90) * 0.6)|round}}
  104. {{content.marqueeHeightUnit|default('px')}};
  105. }
  106. .partners-companies .marquee .company-logo a {
  107. overflow: visible;
  108. }
  109. }
  110. </style>
  111. {# Affichage des éléments #}
  112. <section id="{{ datas.section.id|default('') }}" class="partners-companies-section">
  113. {% if showSectionSettings|default(true) and attribute(content, 'titleTextSection')|default('') is not empty %}
  114. {{ ('<'~attribute(content, 'typeTitleSection')|default('h2')~' class="partners-companies-title">')|raw }}
  115. {% if attribute(content, 'pictogramTitleSection')|default('') is not empty %}
  116. <span class="icon">{{ getLucidIcon(attribute(content, 'pictogramTitleSection')|default('')) }}</span>
  117. {% endif %}
  118. {{ attribute(content, 'titleTextSection')|raw }}
  119. {{ ('</'~attribute(content, 'typeTitleSection')|default('h2')~'>')|raw }}
  120. {% elseif datas.title.text is defined and datas.title.text is not empty %}
  121. {{ ('<'~datas.title.level|default('h2')~' class="partners-companies-title">')|raw }}
  122. {{ datas.title.text|raw }}
  123. {{ ('</'~datas.title.level|default('h2')~'>')|raw }}
  124. {% endif %}
  125. {% if companies is defined and companies is not empty %}
  126. <div class="partners-companies" data-direction="{{ content.marqueeDirection|default('leftToRight') }}" data-speed="{{ content.marqueeSpeed|default(1) }}" data-gap="{{ content.marqueeGap|default(40) }}">
  127. <div class="marquee">
  128. {% for company in companies %}
  129. {% set media = crea_media_get_media(['logo'], company) %}
  130. {% if media is defined and media is not null %}
  131. {% set logoUrl = media.cdnUrl|default('/img/placeholder-company.svg') %}
  132. <div class="company-logo">
  133. {% if company.id is defined and company.id is not null and company.id is not empty %}
  134. <a href="/croisieres?companies[]={{ company.id }}">
  135. <img src="{{ logoUrl }}" alt="{{ company.name|default('Logo compagnie') }}" loading="lazy">
  136. </a>
  137. {% else %}
  138. <img src="{{ logoUrl }}" alt="{{ company.name|default('Logo compagnie') }}" loading="lazy">
  139. {% endif %}
  140. </div>
  141. {% endif %}
  142. {% endfor %}
  143. </div>
  144. </div>
  145. {% endif %}
  146. </section>
  147. {# Le JavaScript du carousel partners companies est maintenant géré par assets/website/js/snippets/partners-companies.js #}
  148. {% endif %}