templates/network/profile/sections/profile_section_hero.html.twig line 1

Open in your IDE?
  1. {% import 'macros/button.macro.twig' as button %}
  2. <div class="relative"
  3.   class="{{ profile.color ?? 'bg-neutral-400' }}"
  4.   style="background-color: {{ profile.color }};"
  5.   id="profile_hero_banner">
  6.   <div class="absolute top-0 block w-full h-full">
  7.     {{ profile.banner
  8.       ? profile.banner.thumbnail('profile-banner-hero').html({
  9.         pictureAttributes: { class: 'w-full h-full max-w-full object-cover', id: 'profile-banner' },
  10.         imgAttributes: { class: 'w-full h-full max-w-full object-cover' }
  11.       })|raw }}
  12.   </div>
  13.   <div class="absolute top-0 left-0 w-full h-full opacity-75 {{
  14.     profile.color
  15.       ?? 'bg-neutral-400'
  16.     }}"
  17.     style="background-color: {{ profile.color }};"></div>
  18.   {% if profile.banner and user.id is defined and user.id == profile.id %}
  19.     <div class="absolute top-0 left-0 z-30 banner-edit-button">
  20.       <form action="{{ path('network_profile_crop_banner_frame') }}" method="POST">
  21.         <button type="submit" class="p-2 bg-neutral-100" title="{{ 'banner-edit'|trans }}">
  22.           {% include 'icons/edit.svg.twig' with { class: 'w-4 h-4 text-black' } only %}
  23.         </button>
  24.       </form>
  25.     </div>
  26.   {% endif %}
  27.   <div class="container relative z-10 pt-8 pb-5 mx-auto md:pb-12 md:pt-24 lg:pb-16 lg:pt-28">
  28.     <div class="flex flex-col w-full sm:flex-row gap-x-3 md:gap-x-7 lg:gap-x-14 gap-y-10">
  29.       <div class="relative flex w-20 h-20 col-span-9 group md:w-36 md:h-36 lg:w-56 lg:h-56 lg:col-span-2"
  30.         id="profile_hero_avatar">
  31.         {% include 'component/avatar.html.twig' with {
  32.           avatar: profile.avatar,
  33.           initials: profile.name|initials,
  34.           size: 'hero',
  35.           rounded: true,
  36.           id: 'profile-avatar'
  37.         } only %}
  38.         {% if 'ROLE_STAFF' in profile.roles %}
  39.           <div class="absolute z-30 flex items-center text-white transform -translate-y-1/2 top-full -right-3 md:gap-2 md:p-1 md:px-3 bg-primary-500">
  40.             <span class="block p-1" title="staff">
  41.               {% include 'icons/users.svg.twig' with { class: 'w-4 h-4' } %}
  42.             </span>
  43.             <span class="text-sm tracking-wide uppercase font-headline">staff</span>
  44.           </div>
  45.         {% elseif 'ROLE_CLUB_HORSE' in profile.roles %}
  46.           <div class="absolute z-30 flex items-center text-white transform -translate-y-1/2 top-full -right-3 md:gap-2 md:p-1 md:px-3 bg-primary-500">
  47.             <span class="block p-1" title="horse">
  48.               {% include 'icons/users.svg.twig' with { class: 'w-4 h-4' } %}
  49.             </span>
  50.             <span class="text-sm tracking-wide uppercase font-headline">
  51.               {{ 'profile.horse.club'|trans }}
  52.             </span>
  53.           </div>
  54.         {% elseif 'ROLE_CLUB_BUSINESS' in profile.roles %}
  55.           <div class="absolute z-30 flex items-center text-white transform -translate-y-1/2 top-full -right-3 md:gap-2 md:p-1 md:px-3 bg-primary-500">
  56.             <span class="block p-1" title="business">
  57.               {% include 'icons/users.svg.twig' with { class: 'w-4 h-4' } %}
  58.             </span>
  59.             <span class="text-sm tracking-wide uppercase font-headline">
  60.               {{ 'profile.business.club'|trans }}
  61.             </span>
  62.           </div>
  63.         {% elseif 'ROLE_CLUB_JOCKEY' in profile.roles %}
  64.           <div class="absolute z-30 flex items-center text-white transform -translate-y-1/2 top-full -right-3 md:gap-2 md:p-1 md:px-3 bg-primary-500">
  65.             <span class="block p-1" title="jockey">
  66.               {% include 'icons/users.svg.twig' with { class: 'w-4 h-4' } %}
  67.             </span>
  68.             <span class="text-sm tracking-wide uppercase font-headline">
  69.               {{ 'profile.jockey.club'|trans }}
  70.             </span>
  71.           </div>
  72.         {% endif %}
  73.         {% if profile.avatar and user and user.id is defined and user.id == profile.id %}
  74.           <div class="absolute inset-0 z-30 items-center justify-center hidden group-hover:flex">
  75.             <form action="{{ path('network_profile_crop_avatar_frame') }}" method="POST">
  76.               <button type="submit" class="p-2 bg-neutral-100" title="{{ 'avatar-edit'|trans }}">
  77.                 {% include 'icons/edit.svg.twig' with { class: 'w-4 h-4 text-black' } only %}
  78.               </button>
  79.             </form>
  80.           </div>
  81.         {% endif %}
  82.       </div>
  83.       <div class="flex-1 min-w-0">
  84.         <div class="flex flex-col h-full min-w-0 tracking-wide text-white font-headline">
  85.           <ul class="flex flex-wrap mb-2 gap-x-3 gap-y-1">
  86.             {% for subprofile in profile.profiles.items %}
  87.               {% if is_primary_profile(profile, subprofile) %}
  88.                 <li class="relative">
  89.                   <div class="relative z-30 flex items-center md:gap-2 md:p-1 md:px-3">
  90.                     {% include 'network/profile/components/subprofile_icon.html.twig' with {
  91.                       subprofile: subprofile
  92.                     } only %}
  93.                     <span class="text-sm font-medium tracking-widest text-white uppercase font-headline">
  94.                       {{ subprofile.identifier|trans }}
  95.                     </span>
  96.                   </div>
  97.                   <div class="absolute inset-0 z-10 hidden pointer-events-none bg-primary-500 md:block"></div>
  98.                 </li>
  99.               {% else %}
  100.                 <li class="relative">
  101.                   <div class="relative z-30 flex items-center md:gap-2 md:p-1 md:px-3">
  102.                     {% include 'network/profile/components/subprofile_icon.html.twig' with {
  103.                       subprofile: subprofile
  104.                     } only %}
  105.                     <span class="text-sm tracking-wide text-white uppercase font-headline">
  106.                       {{ subprofile.identifier|trans }}
  107.                     </span>
  108.                   </div>
  109.                   <div class="absolute inset-0 z-10 hidden pointer-events-none md:block"
  110.                     style="background-color: {{ profile.color }}"></div>
  111.                 </li>
  112.               {% endif %}
  113.             {% endfor %}
  114.           </ul>
  115.           {% if profile.name %}
  116.             <h1 class="text-2xl font-medium leading-tight uppercase md:font-light md:text-4xl lg:text-5xl">
  117.               {{ profile.name }}
  118.             </h1>
  119.           {% endif %}
  120.           <p class="text-xl">
  121.             @{{ profile.username }}
  122.           </p>
  123.           {% if profile.description %}
  124.             <p>
  125.               {{ profile.description|u.truncate(300, '...')|nl2br }}
  126.             </p>
  127.           {% endif %}
  128.           {% if profile.languages %}
  129.             <ul class="flex flex-wrap my-4 gap-x-4 gap-y-1">
  130.               {% for language in profile.languages %}
  131.                 {% set name = language|language_name(app.request.locale) %}
  132.                 <li class="flex items-start gap-2" title="{{ name }}">
  133.                   <img class="w-4 h-4 mt-1 rounded-full md:mt-1"
  134.                     loading="lazy"
  135.                     src="{{ language|language_flag }}"
  136.                     alt="{{ name }}" />
  137.                   <span>{{ name }}</span>
  138.                 </li>
  139.               {% endfor %}
  140.             </ul>
  141.           {% endif %}
  142.         </div>
  143.       </div>
  144.     </div>
  145.   </div>
  146. </div>