src/Eccube/Resource/template/default/Block/header.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. {% set categories = [
  9.     {
  10.         'name':'CONCEPT',
  11.         'href':'/help/about',
  12.     },
  13.     {
  14.         'name':'LINE UP',
  15.         'href':'/products/list',
  16.     },
  17.     {
  18.         'name':'海洋散骨',
  19.         'href':'/sea_burial',
  20.     },
  21.     {
  22.         'name':'SPECIAL',
  23.         'href':'/special',
  24.     },
  25.     {
  26.         'name':'ニュース',
  27.         'href':'/news',
  28.     },
  29.     {
  30.         'name':'ご利用ガイド',
  31.         'href':'/guide',
  32.     },
  33.     {
  34.         'name':'お問い合わせ',
  35.         'href':'/contact/other',
  36.     }
  37. ] %}
  38. {% block stylesheet %}{% endblock %}
  39. {% set isSeaBurialUrl = app.request.pathInfo == '/sea_burial' %}
  40. {% block javascript %}
  41.     {# ハンバーガーメニュー開閉の処理 #}
  42.     <script>
  43.         $(document).ready(function () {
  44.             $(".navigation").hide();
  45.             $(function () {
  46.                 $('.js-hamburger-menu').on('click', function () {
  47.                     $('.navigation').slideToggle(500)
  48.                 });
  49.             });
  50.         });
  51.     </script>
  52.     {% if isSeaBurialUrl %}
  53.         <script>
  54.             var headerIcons = [
  55.                 {
  56.                     id: "logo",
  57.                     before: "/html/template/default/assets/img/logo.webp" ,
  58.                     after: "/html/template/default/assets/img/logo-white.png",
  59.                 },
  60.                 {
  61.                     id: "logoSp",
  62.                     before: "/html/template/default/assets/img/logo.webp",
  63.                     after: "/html/template/default/assets/img/logo-white.png",
  64.                 },
  65.                 {
  66.                     id: "favorite",
  67.                     before: "/html/template/default/assets/icon/favorite.svg",
  68.                     after: "/html/template/default/assets/icon/favorite_white.svg",
  69.                 },
  70.                 {
  71.                     id: "person",
  72.                     before: "/html/template/default/assets/icon/person.svg",
  73.                     after: "/html/template/default/assets/icon/person_white.svg",
  74.                 },
  75.                 {
  76.                     id: "cart",
  77.                     before: "/html/template/default/assets/icon/shopping_cart.svg",
  78.                     after: "/html/template/default/assets/icon/shopping_cart_white.svg",
  79.                 },
  80.                 {
  81.                     id: "hamburger",
  82.                     before: "/html/template/default/assets/icon/hamburger.svg",
  83.                     after: "/html/template/default/assets/icon/hamburger_white.svg",
  84.                 }
  85.             ];
  86.             $(document).ready(function () {
  87.                 $(".change_text_color").addClass("text-white");
  88.                 headerIcons.forEach(function(icon){
  89.                     var iconElement = $('#'+ icon.id);
  90.                     iconElement.attr('src',icon.after);
  91.                 });
  92.                 $(window).on("scroll", function () {
  93.                     const sliderHeight = $(".first_view").height();
  94.                     if (sliderHeight + 150 < $(this).scrollTop()) {
  95.                         $(".change_text_color").removeClass("text-white");
  96.                         headerIcons.forEach(function(icon){
  97.                             console.log("test");
  98.                             var iconElement = $('#'+ icon.id);
  99.                             iconElement.attr('src',icon.before);
  100.                         });
  101.                     } else {
  102.                         $(".change_text_color").addClass("text-white");
  103.                         headerIcons.forEach(function(icon){
  104.                             var iconElement = $('#'+ icon.id);
  105.                             iconElement.attr('src',icon.after);
  106.                         });
  107.                     }
  108.                 });
  109.             });
  110.         </script>
  111.     {% endif %}
  112.     {% if app.request.get('_route') != 'homepage' %}
  113.         <script>
  114.             $(document).ready(function(){
  115.                 $('.js-sp-logo').removeClass('opacity-0');
  116.                 $(".js-logo").removeClass('opacity-0');
  117.                 });
  118.         </script>
  119.     {% endif %}
  120. {% endblock javascript %}
  121. {% block main %}
  122.     {{ include('Block/pagetop.twig') }}
  123.     <div class="change_text_color fixed w-full px-8 h-20 lg:h-16 py-4 lg:px-6 items-center flex justify-between whitespace-nowrap z-50 gap-4 top-0">
  124.         <a href="/" class="md:hidden">
  125.             <img src="{{asset('assets/img/logo.webp') }}"
  126.                 id="logo" alt="" class="w-[162px] h-[48px] xl:w-[113px] xl:h-[33px] js-logo opacity-0 duration-700">
  127.         </a>
  128.         <a href="/" class="hidden md:block">
  129.             <img src="{{asset('assets/img/logo.webp') }}" id="logoSp" alt="" class="w-[162px] h-[48px] lg:w-[113px] lg:h-[33px] js-sp-logo">
  130.         </a>
  131.         <ul class="flex gap-10 lessThanXl:gap-7 text-sm leading-7 lg:hidden">
  132.             {% for category in categories %}
  133.                 <li class="hover">
  134.                     <a href={{category.href}}>{{category.name}}</a>
  135.                 </li>
  136.             {% endfor %}
  137.         </ul>
  138.         <div class="flex items-center gap-4  text-[8px] leading-3 font-bold">
  139.             {% if is_granted('ROLE_USER') %}
  140.                 <a href="/mypage/favorite" class="w-8 h-8 flex-col justify-center items-center flex gap-[6px] hover">
  141.                     <img src="{{asset('assets/icon/favorite.svg')}}"
  142.                         id="favorite" alt="ハートのアイコン" class="w-8 h-8">
  143.                     <p class="lg:hidden">お気に入り</p>
  144.                 </a>
  145.             {% endif %}
  146.             <a href="{% if is_granted('ROLE_USER') %} /mypage {% else %} /mypage/login {% endif %}" class="w-8 h-8  flex flex-col justify-center items-center gap-[6px] text-black hover">
  147.                 <img src="{{asset('assets/icon/person.svg')}}"
  148.                     id="person" alt="ログインのアイコン" class="w-8 h-8">
  149.                 {% if is_granted('ROLE_USER') %}
  150.                     <p class="change_text_color lg:hidden">マイページ</p>
  151.                 {% else %}
  152.                     <p class="change_text_color lg:hidden">ログイン</p>
  153.                 {% endif %}
  154.             </a>
  155.             <a href="/cart" class="w-8 h-8 flex flex-col justify-center items-center gap-[6px] hover">
  156.                 <img src="{{asset('assets/icon/shopping_cart.svg')}}"
  157.                     id="cart" alt="カートのアイコン" class="w-8 h-8">
  158.                 <p class="lg:hidden">カート</p>
  159.             </a>
  160.             {# ハンバーガー #}
  161.             <button class="js-hamburger-menu hover">
  162.                 <img src="{{asset('assets/icon/hamburger.svg')}}"
  163.                     id="hamburger" alt="ハンバーガーメニュー" class=" w-8 h-8  hidden lg:block">
  164.             </button>
  165.         </div>
  166.     </div>
  167.     <nav class="navigation hidden fixed top-0 right-0 z-50 w-full overflow-y-scroll h-screen ">
  168.         {{ include('hamburger.twig') }}
  169.     </nav>
  170. {% endblock %}