templates/component/accordion_content.html.twig line 1

Open in your IDE?
  1. {#
  2.     component: accordion content
  3.     layout {string}: 1 pour l'image à droite, 2 pour l'image à gauche
  4.     contents: [{
  5.         text {string}: Texte de la section 
  6.         title {string}: Titre de la section
  7.         image {image}: Image de la section
  8.             size: {
  9.                 width: "660",
  10.                 height: "840"
  11.             }
  12.         links: [{
  13.             text {string}: Texte du lien
  14.             to {string}: Lien
  15.         }]
  16.     }]
  17. #}
  18. {% set props = {
  19.     layout: '1',
  20.     contents: [{
  21.         text:null,
  22.         title:null,
  23.         image:null,
  24.         links:null
  25.     }]
  26. }|merge(props|default({}))  %}
  27. <section data-component="accordion-content" class="AccordionContent-component layout-{{ props.layout }}">
  28.     <div class="l-container">
  29.         <div class="l-row">
  30.             <div
  31.                 class="l-column AccordionContent-main">
  32.                 {# Nav #}
  33.                 <div
  34.                     class="1-row AccordionContent-nav">
  35.                     {# Arrows #}
  36.                     <div
  37.                         class="AccordionContent-navButtons">
  38.                         {# Previous button #}
  39.                         <button ref="previousButton" class="AccordionContent-navButton AccordionContent-navPreviousButton">
  40.                             {% include "component/svg.html.twig" with {
  41.                                 props: {
  42.                                 name: 'arrow-left'
  43.                                 }    
  44.                             } %}
  45.                         </button>
  46.                         {# Next button #}
  47.                         <button ref="nextButton" class="AccordionContent-navButton AccordionContent-navNextButton">
  48.                             {% include "component/svg.html.twig" with {
  49.                                 props: {
  50.                                 name: 'arrow-right'
  51.                                 }
  52.                             } %}
  53.                         </button>
  54.                     </div>
  55.                 </div>
  56.                 {% if props.heading is defined %}
  57.                     {# Heading #}
  58.                     {% include "component/heading.html.twig" with {
  59.                         props: props.heading
  60.                     } %}
  61.                 {% endif %}
  62.                 {% for content in props.contents %}
  63.                     <div
  64.                         class="AccordionContent-contentItem {% if loop.index0 == 0 %}opened{% endif %}" ref="items">
  65.                         {# Item title #}
  66.                         <p class="AccordionContent-contentItemTitle">{{ content.title }}</p>
  67.                         <div class="AccordionContent-contentItemMain" ref="main">
  68.                             {% if content.text is defined %}
  69.                                 {# Item text #}
  70.                                 <p class="AccordionContent-contentItemText">
  71.                                     {% include "component/wysiwyg.html.twig" with {
  72.                                     props: {
  73.                                         content: content.text
  74.                                     }
  75.                                     } %}
  76.                                 </p>
  77.                             {% endif %}
  78.                             {% if content.links is defined %}
  79.                                 {# Item links #}
  80.                                 <div class="AccordionContent-contentItemLinks" ref="buttons">
  81.                                     {% for link in content.links %}
  82.                                         <div class="AccordionContent-contentItemLinkContainer">
  83.                                             {% include "component/button.html.twig" with {
  84.                                                 props: link
  85.                                             } %}
  86.                                         </div>
  87.                                     {% endfor %}
  88.                                 </div>
  89.                             {% endif %}
  90.                         </div>
  91.                     </div>
  92.                 {% endfor %}
  93.             </div>
  94.             <div class="l-column AccordionContent-media" ref="container">
  95.                 <div class="AccordionContent-mediaRatioHelper">
  96.                     {% for content in props.contents %}
  97.                         <div class="AccordionContent-imageContainer {% if loop.index0 == 0 %}opened{% endif %}" ref="images">
  98.                             {% include "component/image.html.twig" with {
  99.                             props: content.image
  100.                         } %}
  101.                         {# {% include "component/picture.html.twig" with {
  102.                             props: content.image|merge({
  103.                                 srcWebp: (content.image.src) ? asset(content.image.src | imagine_filter('convert_img_to_webp')) : ''
  104.                             })
  105.                         } %} #}
  106.                         </div>
  107.                     {% endfor %}
  108.                 </div>
  109.             </div>
  110.         </div>
  111.     </div>
  112. </section>