templates/front/partials/menu/header-primary.html.twig line 1

Open in your IDE?
  1. {% macro menu_links(items, depth) %}
  2.     {% import _self as macros %}
  3.     {% for item in items %}
  4.         <li js-header-main-item>
  5.         {% if item.children is defined and item.children is not null and item.children|length > 0 %}
  6.             <button class="header-main-nav__item header-main-nav__item--level0" js-header-toggle-panel="level0">
  7.                 {{item.label}}
  8.                 <svg width="16" height="9" class="icon ml-2 shrink-0 hidden xl:block">
  9.                     <use href="#icon-arrow-down" xlink:href="#icon-arrow-down"></use>
  10.                 </svg>
  11.                 <svg width="12" height="20" class="icon icon--white opacity-50 ml-2 shrink-0 xl:hidden">
  12.                     <use href="#icon-chevron-right-2" xlink:href="#icon-chevron-right-2"></use>
  13.                 </svg>
  14.             </button>
  15.             <div class="panel panel--level1" js-header-panel>
  16.                 <div class="panel__inner">
  17.                     <div class="fluid-grid pt-9 xl:pt-0">
  18.                         <button class="bt-back only-mobile" js-header-back>
  19.                             <svg width="8" height="16" class="icon opacity-70 mr-2 shrink-0">
  20.                                 <use href="#icon-chevron-right" xlink:href="#icon-chevron-right"></use>
  21.                             </svg>
  22.                             Retour
  23.                         </button>
  24.                         <ul class="xl:pt-3 pb-8 xl:pb-0">
  25.                             {{ macros.menu_links2(item.children, (depth+1) ) }}
  26.                         </ul>
  27.                     </div>
  28.                 </div>
  29.             </div>
  30.         {% else %}
  31.             <a class="header-main-nav__item header-main-nav__item--level0" href="{% if item.page %}{{ page_url(item.page, 'front') }}{% else %}{{ item.link }}{% endif %}">{{ item.label }}</a>
  32.         {% endif %}
  33.         </li>
  34.     {% endfor %}
  35. {% endmacro %}
  36. {% macro menu_links2(items, depth) %}
  37.     {% import _self as macros %}
  38.     {% for item in items %}
  39.         <li class="header-main-nav__item-wrap">
  40.             {% if item.children is defined and item.children is not null and item.children|length > 0 %}
  41.                 <button class="header-main-nav__item header-main-nav__item--level1 only-mobile" js-header-toggle-panel>
  42.                     {{item.label}}
  43.                     <svg width="12" height="20" class="icon icon--white opacity-50 ml-2 shrink-0">
  44.                         <use href="#icon-chevron-right-2" xlink:href="#icon-chevron-right-2"></use>
  45.                     </svg>
  46.                 </button>
  47.                 <div class="panel panel--level2 w-full p-8 xl:p-0" js-header-panel>
  48.                     <button class="bt-back col-12 flex items-center font-weight-bold text-white uppercase opacity-70 only-mobile" js-header-back>
  49.                         <svg width="8" height="16" class="icon opacity-70 mr-2 shrink-0">
  50.                             <use href="#icon-chevron-right" xlink:href="#icon-chevron-right"></use>
  51.                         </svg>
  52.                         Retour
  53.                     </button>
  54.                     <a target="{{ item.target }}" rel="noopener" href="{% if item.page %}{{ page_url(item.page, 'front') }}{% else %}{{ item.link }}{% endif %}" class="header-main-nav__item header-main-nav__item--level1 mt-8 xl:mt-0 mb-2 xl:mb-0 {{ item.class }}">
  55.                         {{item.label}}
  56.                         <div class="picto relative ml-2 inline-block">
  57.                             <svg class="icon icon--white abs-center">
  58.                                 <use href="#icon-arrow" xlink:href="#icon-arrow"></use>
  59.                             </svg>
  60.                         </div>
  61.                     </a>
  62.                     <ul class="list-none xl:mt-4">
  63.                         {{ macros.menu_links3(item.children, (depth+1) ) }}
  64.                     </ul>
  65.                 </div>
  66.             {% else %}
  67.             <a target="{{ item.target }}" href="{% if item.page %}{{ page_url(item.page, 'front') }}{% else %}{{ item.link }}{% endif %}" class="header-main-nav__item header-main-nav__item--level1">
  68.                 {{item.label}}
  69.                 <div class="picto relative ml-2 hidden xl:inline-block">
  70.                     <svg class="icon icon--white abs-center">
  71.                         <use href="#icon-arrow" xlink:href="#icon-arrow"></use>
  72.                     </svg>
  73.                 </div>
  74.             </a>
  75.             {% endif %}
  76.         </li>
  77.     {% endfor %}
  78. {% endmacro %}
  79. {% macro menu_links3(items, depth) %}
  80.     {% import _self as macros %}
  81.     {% for item in items %}
  82.        <li>
  83.             <a target="{{ item.target }}" rel="noopener" href="{% if item.page %}{{ page_url(item.page, 'front') }}{% else %}{{ item.link }}{% endif %}" class="header-main-nav__item--level2 inline-flex justify-between xl:justify-start items-start xl:items-center font-weight-regular mt-4 xl:mt-0 {% if item.class is defined and item.class is not null %}{{item.class}}{% endif %}">
  84.                 <div class="picto relative shrink-0 mr-3 only-desktop">
  85.                     <svg width="7" height="12" class="icon shrink-0 abs-center">
  86.                         <use href="#icon-chevron-right" xlink:href="#icon-chevron-right"></use>
  87.                     </svg>
  88.                 </div>
  89.                 <span>{{item.label}}</span>
  90.             </a>
  91.         </li>
  92.     {% endfor %}
  93. {% endmacro %}
  94. {% import _self as macros %}
  95. <ul class="list-none flex flex-col xl:flex-row w-full xl:w-auto h-full px-8 xl:px-0 py-16 xl:py-0">
  96.     {% set depth = 1 %}
  97.     {{ macros.menu_links(menu.items, depth) }}
  98.     <li class="flex items-center">
  99.         <a href="{{ app.user ? page_url('publications-list-adherent','front') : page_url('login','front') }}" class="button button--rounded button--rounded--S button--green">
  100.             <svg width="12" height="15" class="icon mr-2">
  101.                 <use href="#icon-profile" xlink:href="#icon-profile"></use>
  102.             </svg>
  103.             Espace adhĂ©rent
  104.         </a>
  105.     </li>
  106. </ul>