<!-- sections/top-bar.liquid -->
{{ 'hdt-top-bar.css' | asset_url | stylesheet_tag }}
<div class="hdt-top-bar hdt-s-gradient{% if section.settings.show_line_separator and section.blocks.size > 0 %} hdt-top-bar--bottom-border{% endif %}" color-scheme="{{ section.settings.color_scheme }}">
  <div class="hdt-container{% if section.settings.fullwidth %}-full hdt-px-15 lg:hdt-px-40{% endif %}">
    {%- if section.blocks.size > 0 -%}
      <div class="hdt-top-bar__wrap hdt-row-grid hdt-grid-cols-1 md:hdt-grid-cols-1 lg:hdt-grid-cols-{{ section.blocks.size }} hdt-align-center">
        {%- for block in section.blocks -%}
          {%- case block.type -%}
            {%- when 'socials' -%}
              <div class="hdt-top-bar__item hdt-top-bar__socials hdt-text-center{% if block.settings.hide %} hdt-hidden md:hdt-hidden lg:hdt-block{% endif %}">
                {%- render 'social_sharing', socials_style: block.settings.socials_style, socials_size: 'small' -%} 
              </div>
            {%- when 'text' -%}
              {%- capture cap_icon_arrow -%}<svg class="hdt-inline-block" xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8" fill="none"><path d="M0.861539 8L0 7.13846L5.90769 1.23077H0.615385V0H8V7.38462H6.76923V2.09231L0.861539 8Z" fill="currentColor"></path></svg>{%- endcapture -%}
              {%- capture class_format_richtext -%}{% if block.settings.adding_border %} hdt-rte{% else %} hdt-tag-list{% endif %}{%- endcapture -%}
              <div class="hdt-top-bar__item hdt-top-bar__text hdt-text-center{% if block.settings.hide %} hdt-hidden md:hdt-hidden lg:hdt-block{% endif %}">
                {%- if block.settings.text1 != blank or block.settings.text2 != blank or block.settings.text3 != blank -%}
                  <hdt-slider autoHeight id="Slider-{{ section.id }}" class="hdt-top-bar-text__slider hdt-slider lg:hdt-slides-1 hdt-relative hdt-oh"  config='{ "loop": true, "autoPlay": {{ block.settings.au_time | times: 1000 }}, "pauseOnHover": {{ block.settings.pause_when_hover }}, "autoHeight": true }'>
                    <div class="hdt-slider__viewport">
                      <div class="hdt-slider__container">
                        {%- if block.settings.text1 != blank -%}<div class="hdt-slider__slide hdt-top-bar-text__item{{ class_format_richtext }}">{{- block.settings.text1 | replace: '[icon_arrow]', cap_icon_arrow -}}</div>{%- endif -%}
                        {%- if block.settings.text2 != blank -%}<div class="hdt-slider__slide hdt-top-bar-text__item{{ class_format_richtext }}">{{- block.settings.text2 | replace: '[icon_arrow]', cap_icon_arrow -}}</div>{%- endif -%}
                        {%- if block.settings.text3 != blank -%}<div class="hdt-slider__slide hdt-top-bar-text__item{{ class_format_richtext }}">{{- block.settings.text3 | replace: '[icon_arrow]', cap_icon_arrow -}}</div>{%- endif -%}
                      </div>
                    </div>
                  </hdt-slider>
                {%- endif -%}
              </div>
            {%- when 'cur' -%}
              <div class="hdt-top-bar__item hdt-top-bar__cur hdt-text-center{% if block.settings.hide %} hdt-hidden md:hdt-hidden lg:hdt-block{% endif %}">
                {%- if block.settings.html != blank -%}<div class="hdt-top-bar__html hdt-inline-block">{{ block.settings.html }}</div>{%- endif -%}
                {%- if block.settings.show_currency -%}
                  {%- unless localization.available_countries.size <= 1 and settings.currency_type == "1" -%}
                    {%- render 'hdt_currency' -%}
                  {%- endunless -%}
                {%- endif -%}
                {%- if block.settings.show_language and localization.available_languages.size > 1 -%}
                    {%- render 'hdt_language' -%}
                {%- endif -%}
              </div>
            {%- when 'link_list' -%}
              <div class="hdt-top-bar__item hdt-top-bar__menu hdt-text-center{% if block.settings.hide %} hdt-hidden md:hdt-hidden lg:hdt-block{% endif %}">
                {%- if block.settings.menu_link != blank -%}
                  <ul class="hdt-top-bar__linklist">
                    {%- for link in block.settings.menu_link.links -%}
                      <li class="hdt-inline-block"><a href="{{ link.url }}"{% if link.current %} class="hdt-link-active"{% endif %}>{{ link.title }}</a></li>
                    {%- endfor -%}
                  </ul>
                {%- endif -%}
              </div>
            {%- when 'liquid' -%}
              <div class="hdt-top-bar__item hdt-top-bar__custom-liquid hdt-text-center{% if block.settings.hide %} hdt-hidden md:hdt-hidden lg:hdt-block{% endif %}">{%- if block.settings.custom_liquid != blank -%} {{ block.settings.custom_liquid }} {%- endif -%}</div>
            {%- when '@app' -%}
              <div class="hdt-top-bar__item hdt-top-bar__app hdt-text-center">{%- render block -%}</div>
          {%- endcase -%}
        {%- endfor -%}
      </div>
    {%- endif -%}
  </div>
</div>
{% schema %}
{
  "name": "t:sections.top-bar.name",
  "class": "hdt-section-group hdt-top-bar-section",
  "max_blocks": 3,
  "limit": 1,
  "enabled_on": {
    "groups": [
      "header"
    ]
  },
  "settings": [
    {
      "type": "color_scheme",
      "id": "color_scheme",
      "label": "t:sections.all.colors.label"
    },
    {
      "type": "checkbox",
      "id": "show_line_separator",
      "label": "t:sections.top-bar.settings.show_line_separator.label"
    },
    {
      "type": "checkbox",
      "id": "fullwidth",
      "label": "t:sections.all.section_fullwidth",
      "default": true
    }
  ],
  "blocks": [
    {
      "type": "socials",
      "name": "Socials",
      "limit": 1,
      "settings": [
        {
          "type": "paragraph",
          "content": "t:settings_schema.social-media.settings.paragraph.content"
        },
        {
          "type": "select",
          "id": "socials_style",
          "label": "t:settings_schema.social-media.settings.social_style.label",
          "default": "default",
          "options": [
            {
              "value": "default",
              "label": "t:settings_schema.social-media.settings.social_style.options__1.label"
            },
            {
              "value": "outline",
              "label": "t:settings_schema.social-media.settings.social_style.options__2.label"
            },
            {
              "value": "simple",
              "label": "t:settings_schema.social-media.settings.social_style.options__3.label"
            }
          ]
        },
        {
          "type": "checkbox",
          "id": "hide",
          "label": "t:sections.top-bar.blocks.hide",
          "default": false
        }
      ]
    },
    {
      "type": "text",
      "name": "Rich text",
      "settings": [
        {
          "type": "inline_richtext",
          "id": "text1",
          "label": "t:sections.top-bar.blocks.text.settings.text1",
          "default": "Spring sale discount off 50%",
          "info": "t:sections.top-bar.blocks.text.settings.info"
        },
        {
          "type": "inline_richtext",
          "id": "text2",
          "label": "t:sections.top-bar.blocks.text.settings.text2",
          "default": "Summer sale discount off 70%",
          "info": "t:sections.top-bar.blocks.text.settings.info"
        },
        {
          "type": "inline_richtext",
          "id": "text3",
          "label": "t:sections.top-bar.blocks.text.settings.text3",
          "info": "t:sections.top-bar.blocks.text.settings.info"
        },
        {
          "type": "checkbox",
          "id": "adding_border",
          "label": "t:sections.all.adding_border.label"
        },
        {
          "type": "range",
          "id": "au_time",
          "min": 0,
          "max": 30,
          "step": 0.5,
          "label": "t:sections.top-bar.blocks.text.settings.au_time.label",
          "info": "t:sections.top-bar.blocks.text.settings.au_time.info",
          "unit": "sec",
          "default": 3.5
        },
        {
          "type": "checkbox",
          "id": "pause_when_hover",
          "default": false,
          "label": "t:sections.top-bar.blocks.text.settings.au_time.pause_when_hover"
        },
        {
          "type": "checkbox",
          "id": "hide",
          "label": "t:sections.top-bar.blocks.hide",
          "default": false
        }
      ]
    },
    {
      "type": "cur",
      "name": "t:sections.top-bar.blocks.cur.name",
      "limit": 1,
      "settings": [
        {
          "type": "html",
          "id": "html",
          "label": "t:sections.top-bar.blocks.html.settings.label",
          "info": "t:sections.top-bar.blocks.html.settings.info"
        },
        {
          "type": "checkbox",
          "id": "show_currency",
          "label": "t:sections.top-bar.blocks.cur.settings.show_currency.label",
          "default": true
        },
        {
          "type": "checkbox",
          "id": "show_language",
          "label": "t:sections.top-bar.blocks.cur.settings.show_language.label",
          "default": true
        },
        {
          "type": "checkbox",
          "id": "hide",
          "label": "t:sections.top-bar.blocks.hide",
          "default": false
        }
      ]
    },
    {
      "type": "link_list",
      "name": "Menu",
      "limit": 1,
      "settings": [
        {
          "type": "link_list",
          "id": "menu_link",
          "label": "Select menu"
        },
        {
          "type": "checkbox",
          "id": "hide",
          "label": "t:sections.top-bar.blocks.hide",
          "default": false
        }
      ]
    },
    {
      "type": "liquid",
      "name": "t:sections.top-bar.blocks.liquid.name",
      "settings": [
        {
          "type": "liquid",
          "id": "custom_liquid",
          "label": "t:sections.top-bar.blocks.liquid.settings.label",
          "info": "t:sections.top-bar.blocks.liquid.settings.info"
        },
        {
          "type": "checkbox",
          "id": "hide",
          "label": "t:sections.top-bar.blocks.hide",
          "default": false
        }
      ]
    },
    {
      "type": "@app"
    }
  ],
  "presets": [
    {
      "name": "Top bar",
      "blocks": [
        {
          "type": "liquid",
          "settings": {
            "hide": true,
            "custom_liquid": "Welcome customers to your store"
          }
        },
        {
          "type": "text"
        },
        {
          "type": "cur",
          "settings": {
            "hide": true
          }
        }
      ]
    }
  ]
}
{% endschema %}