templates/header.html.twig line 1

  1. {% set navLinks = [
  2.   {
  3.     title: 'About',
  4.     url: '/about'
  5.   },
  6.   {
  7.     title: 'Team',
  8.     url: '/team'
  9.   },
  10.   {
  11.     title: 'News & Events',
  12.     url: '/news'
  13.   },
  14.   {
  15.     title: 'Help Desk',
  16.     url: '/help-desk'
  17.   },
  18.   {
  19.     title: 'Party Pillar',
  20.     url: '/party-pillar'
  21.   },
  22.   {
  23.     title: 'Contact',
  24.     url: '/contact'
  25.   }
  26. ] %}
  27. {% set avatar = null %}
  28. {% if app.user is not null %}
  29.   {% if  app.user.getUserImagesByuserImageTypeCode('LG') is not null %}
  30.     {% set avatar = '/uploads/media/' ~ app.user.getUserImagesByuserImageTypeCode('LG').getImageMetaData().getName() %}
  31.   {% else %}
  32.     {% set avatar = 'https://avatar.uimaterial.com/?setId=7Jt5O28RnCHPENR1Cvr4&name=' ~ app.user.firstName ~ '&size=512' %}
  33.   {% endif %}
  34. {% endif %}
  35. <div class="fixed z-50 top-0 w-full backdrop-blur-xl bg-white/60">
  36.     <nav class="flex lg:px-8 py-2 px-4 justify-between mx-auto">
  37.         <div class="flex w-full items-center justify-between">
  38.             <div class="md:w-1/3 w-1/2">
  39.                 <a class="max-w-max inline-flex items-center" href="/">
  40.                     <img class="h-12" src="{{ asset('/images/logo.svg') }}" alt="RSP"/>
  41.                     <span class="xl:inline-block lg:hidden whitespace-nowrap text-brand md:text-2xl text-base font-bold">
  42.                         ONLD UK
  43.                     </span>
  44.                 </a>
  45.             </div>
  46.             <div
  47.         class="
  48.           menu
  49.           lg:w-auto
  50.           md:w-96
  51.           w-72
  52.           max-w-full
  53.           lg:flex
  54.           hidden
  55.           lg:flex-row
  56.           flex-col
  57.           lg:relative
  58.           fixed
  59.           lg:bg-transparent
  60.           bg-white
  61.           z-30
  62.           lg:items-center
  63.           lg:justify-around
  64.           lg:h-auto
  65.           h-screen
  66.           text-white
  67.           top-0
  68.           bottom-0
  69.           lg:left-0
  70.           -left-full
  71.           transition-all
  72.           lg:pt-0
  73.           pt-12
  74.           lg:px-0
  75.           px-6
  76.         "
  77.       >
  78.                 <button class="lg:hidden navbar-close absolute right-3 top-5 p-4" href="#">
  79.                     <svg class="w-4 h-4" viewbox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
  80.                         <path d="M6.94004 6L11.14 1.80667C11.2656 1.68113 11.3361 1.51087 11.3361 1.33333C11.3361 1.1558 11.2656 0.985537 11.14 0.860002C11.0145 0.734466 10.8442 0.66394 10.6667 0.66394C10.4892 0.66394 10.3189 0.734466 10.1934 0.860002L6.00004 5.06L1.80671 0.860002C1.68117 0.734466 1.51091 0.663941 1.33337 0.663941C1.15584 0.663941 0.985576 0.734466 0.860041 0.860002C0.734505 0.985537 0.66398 1.1558 0.66398 1.33333C0.66398 1.51087 0.734505 1.68113 0.860041 1.80667L5.06004 6L0.860041 10.1933C0.797555 10.2553 0.747959 10.329 0.714113 10.4103C0.680267 10.4915 0.662842 10.5787 0.662842 10.6667C0.662842 10.7547 0.680267 10.8418 0.714113 10.9231C0.747959 11.0043 0.797555 11.078 0.860041 11.14C0.922016 11.2025 0.99575 11.2521 1.07699 11.2859C1.15823 11.3198 1.24537 11.3372 1.33337 11.3372C1.42138 11.3372 1.50852 11.3198 1.58976 11.2859C1.671 11.2521 1.74473 11.2025 1.80671 11.14L6.00004 6.94L10.1934 11.14C10.2554 11.2025 10.3291 11.2521 10.4103 11.2859C10.4916 11.3198 10.5787 11.3372 10.6667 11.3372C10.7547 11.3372 10.8419 11.3198 10.9231 11.2859C11.0043 11.2521 11.0781 11.2025 11.14 11.14C11.2025 11.078 11.2521 11.0043 11.286 10.9231C11.3198 10.8418 11.3372 10.7547 11.3372 10.6667C11.3372 10.5787 11.3198 10.4915 11.286 10.4103C11.2521 10.329 11.2025 10.2553 11.14 10.1933L6.94004 6Z" fill="#556987"></path>
  81.                     </svg>
  82.                 </button>
  83.                 {% for link in navLinks %}
  84.                     <div class="inline-block leading-[3rem] group overflow-hidden max-w-fit lg:mr-8">
  85.                         <a href="{{ link.url }}" class="group-hover:text-brand inline-block text-base font-normal leading-[3rem] text-gray-900 whitespace-nowrap">
  86.                             {{ link.title }}
  87.                         </a>
  88.                         <div class="w-full h-0.5 bg-brand mt-1.5 transition-all -translate-x-full scale-100 group-hover:translate-x-0 duration-500"></div>
  89.                     </div>
  90.                 {% endfor %}
  91.                 {% if app.user is null %}
  92.                     <div class="inline-block leading-[3rem] group overflow-hidden lg:mr-8 max-w-fit">
  93.                         <a href="/login" class="group-hover:text-brand inline-block text-base font-normal leading-[3rem] text-gray-900 whitespace-nowrap">
  94.                             Login
  95.                         </a>
  96.                         <div class="w-full h-0.5 bg-brand mt-1.5 transition-all -translate-x-full scale-100 group-hover:translate-x-0 duration-500"></div>
  97.                     </div>
  98.           <a
  99.             href="/donate"
  100.             class="
  101.               bg-brand
  102.               hover:bg-transparent
  103.               border
  104.               border-brand
  105.               transition-all
  106.               duration-300
  107.               py-2
  108.               px-5
  109.               rounded-full
  110.               text-base
  111.               font-semibold
  112.               leading-6
  113.               text-white
  114.               hover:text-brand
  115.               lg:w-auto
  116.               w-full
  117.               text-center
  118.               lg:mt-0
  119.               mt-auto
  120.               lg:mb-0
  121.               mb-4
  122.             "
  123.           >
  124.             Donate
  125.           </a>
  126.                 {% else %}
  127.           <a
  128.             href="/donate"
  129.             class="
  130.               lg:inline
  131.               hidden
  132.               bg-brand
  133.               hover:bg-transparent
  134.               border
  135.               border-brand
  136.               transition-all
  137.               duration-300
  138.               py-2
  139.               px-5
  140.               rounded-full
  141.               text-base
  142.               font-semibold
  143.               leading-6
  144.               text-white
  145.               hover:text-brand
  146.               lg:w-auto
  147.               w-full
  148.               text-center
  149.               lg:mr-5
  150.             "
  151.           >
  152.             Donate
  153.           </a>
  154.           <div class="relative inline-flex h-12 group lg:mt-0 mt-4" role="button">
  155.             <a href="/user/profile" class="inline-flex items-center gap-x-4 lg:w-10 lg:h-10">
  156.               <img
  157.                 src="{{ avatar }}"
  158.                 alt="{{ app.user.firstName }}"
  159.                 class="lg:w-full lg:h-full w-10 h-10 object-cover object-center rounded-full bg-brand"
  160.               >
  161.               <span class="lg:hidden group-hover:text-brand inline-block text-base font-normal leading-[3rem] text-gray-900 whitespace-nowrap">Account</span>
  162.             </a>
  163.             <div class="lg:hidden hidden lg:group-hover:block lg:absolute z-10 lg:top-12 lg:-right-1 lg:bg-white min-w-max lg:w-48 flex flex-col w-full rounded-xl shadow-xl py-6">
  164.               <a href="/user/profile" class="block hover:bg-slate-200 py-2.5 px-4 text-base font-normal text-neutral-600">
  165.                 My Account
  166.               </a>
  167.                <a href="/user/payment-history" class="block hover:bg-slate-200 py-2.5 px-4 text-base font-normal text-neutral-600">
  168.                 My Payment History
  169.               </a>
  170.               <a href="/user/messages" class="block hover:bg-slate-200 py-2.5 px-4 text-base font-normal text-neutral-600">
  171.                 My Messages
  172.               </a>
  173.               <a href="/logout" class="block hover:bg-slate-200 py-2.5 px-4 text-base font-normal text-neutral-600">
  174.                 Logout
  175.               </a>
  176.             </div>
  177.           </div>
  178.           <div class="lg:hidden inline-block leading-[3rem] overflow-hidden lg:mr-8 mt-4 relative">
  179.             <a
  180.               href="/donate"
  181.               class="
  182.                 inline-block
  183.                 w-full
  184.                 lg:hidden
  185.                 bg-brand
  186.                 hover:bg-transparent
  187.                 border
  188.                 border-brand
  189.                 transition-all
  190.                 duration-300
  191.                 py-2
  192.                 px-5
  193.                 rounded-full
  194.                 text-base
  195.                 font-semibold
  196.                 leading-6
  197.                 text-white
  198.                 hover:text-brand
  199.                 lg:w-auto
  200.                 text-center
  201.                 lg:mr-5
  202.               "
  203.             >
  204.               Donate
  205.             </a>
  206.                         <a href="/logout" class="w-full text-center hover:text-brand inline-block text-base font-normal leading-[3rem] text-gray-900 whitespace-nowrap">
  207.                             Logout
  208.                         </a>
  209.                     </div>
  210.                 {% endif %}
  211.       </div>
  212.       <div class="ml-auto justify-end flex lg:hidden">
  213.         <button class="navbar-open w-10 h-10 bg-transparent transition-all inline-flex items-center justify-center rounded">
  214.           <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" class="fill-brand w-6 h-6" viewBox="0 0 50 50">
  215.             <path d="M 0 9 L 0 11 L 50 11 L 50 9 Z M 0 24 L 0 26 L 50 26 L 50 24 Z M 0 39 L 0 41 L 50 41 L 50 39 Z"></path>
  216.           </svg>
  217.         </button>
  218.       </div>
  219.     </div>
  220.   </nav>
  221. </div>
  222. <script>
  223.   const menu = document.querySelector('.menu')
  224.   const opener = document.querySelector('.navbar-open')
  225.   const closer = document.querySelector('.navbar-close')
  226.   const backdrop = document.querySelector('.backdrop')
  227.   const closeMenu = () => {
  228.     document.body.classList.remove('overflow-hidden')
  229.     menu.classList.add('hidden')
  230.     menu.classList.remove('flex')
  231.     menu.classList.remove('-left-full')
  232.     menu.classList.remove('left-0')
  233.     backdrop.classList.add('hidden')
  234.   }
  235.   backdrop.addEventListener('click', () => {
  236.     closeMenu()
  237.   })
  238.   opener.addEventListener('click', () => {
  239.     document.body.classList.add('overflow-hidden')
  240.     menu.classList.remove('hidden')
  241.     menu.classList.add('flex')
  242.     menu.classList.remove('-left-full')
  243.     menu.classList.add('left-0')
  244.     backdrop.classList.remove('hidden')
  245.   })
  246.   window.addEventListener('resize', (e) => {
  247.     e.preventDefault()
  248.     if (window.innerWidth >=1536)
  249.       document.body.classList.remove('overflow-hidden')
  250.   })
  251.   closer.addEventListener('click', () => {
  252.     closeMenu()
  253.   })
  254. </script>