{{ 'section-faq-v2.css' | asset_url | stylesheet_tag }}

<section {% render 'section-attr' %}>
  <div class='faq-v2' style='background: {{section.settings.faq_bg }}'>
    <xo-container {% render 'section-layout' %}>
      <xo-grid>
        <div
          class='faq-v2__center'
          style='
            {% if section.settings.reverse_layout %}
              --xs: 12; --order-xs: 2; --sm: 6; --order-sm: 2; --lg: 6; --order-lg: 2;
            {% else %}
            --xs: 12; --sm: 6; --lg: 6;
                {% endif %}
          '
        >
          <div class='faq-v2-left'>
            <div class='faq-v2-right__heading'>
              {%- if section.settings.sub != blank -%}
                <div class='faq-v2-right__sub'>{{ section.settings.sub }}</div>
              {%- endif -%}
              {%- if section.settings.heading -%}
                <h2 class='faq-v2-right__title'>{{ section.settings.heading }}</h2>
              {%- endif -%}
              {%- if section.settings.desc != blank -%}
                <div class='faq-v2-right__desc'>{{ section.settings.desc }}</div>
              {%- endif -%}
            </div>

            <div class='faq-v2-right__provider xo-scrollbar'>
              <xo-collapse-provider xo-duration='300'>
                {%- for block in section.blocks -%}
                  <div class='faq-v2-right__row'>
                    {%- if block.settings.question != blank -%}
                      <xo-collapse-trigger class='faq-v2-right__trigger'>
                        <div class='faq-v2-right__arrow'>
                          {%
                            render 'icon',
                            name: 'icon-arrow-short-below',
                            icon_size: '11px',
                          %}
                        </div>
                        <div class='faq-v2-right__question'>{{ block.settings.question }}</div>
                      </xo-collapse-trigger>
                    {%- endif -%}
                    {%- if block.settings.anwser != blank and block.settings.question != blank -%}
                      <xo-collapse>
                        <div class='faq-v2-right__anwser'>{{ block.settings.anwser }}</div>
                      </xo-collapse>
                    {%- endif -%}
                  </div>
                {%- endfor -%}
              </xo-collapse-provider>
            </div>
          </div>
        </div>
        <div style='--xs: 12; --sm: 6; --lg: 6;'>
          <div class='faq-v2-right'>
            {%- render 'image', image: section.settings.faq_img -%}
          </div>
        </div>
      </xo-grid>
    </xo-container>
  </div>
</section>

{% schema %}
{
  "name": "t:sections.faq_v2.name",
  "tag": "section",
  "class": "section",
  "blocks": [
    {
      "type": "question",
      "name": "t:sections.faq_v2.blocks.question.name",
      "settings": [
        {
          "type": "text",
          "id": "question",
          "label": "t:sections.faq_v2.blocks.question.settings.title.label",
          "default": "t:sections.faq_v2.blocks.question.settings.title.default"
        },
        {
          "type": "richtext",
          "id": "anwser",
          "label": "t:sections.faq_v2.blocks.question.settings.content.label",
          "default": "t:sections.faq_v2.blocks.question.settings.content.default"
        }
      ]
    }
  ],
  "settings": [
    {
      "type": "select",
      "id": "width",
      "label": "t:sections.all.width.label",
      "default": "box",
      "options": [
        {
          "value": "box",
          "label": "t:sections.all.width.options__1.label"
        },
        {
          "value": "wide",
          "label": "t:sections.all.width.options__2.label"
        },
        {
          "value": "fullwidth",
          "label": "t:sections.all.width.options__3.label"
        }
      ]
    },
    {
      "type": "header",
      "content": "t:sections.faq_v2.settings.content.label"
    },
    {
      "type": "checkbox",
      "id": "reverse_layout",
      "label": "t:sections.faq_v2.settings.reverse_layout.label",
      "default": false
    },
    {
      "type": "image_picker",
      "id": "faq_img",
      "label": "t:sections.faq_v2.settings.faq_img.label",
      "info": "Support jpg, jpeg, png, svg"
    },
    {
      "type": "text",
      "id": "sub",
      "label": "t:sections.faq_v2.settings.sub.label",
      "default": "faqs"
    },
    {
      "type": "text",
      "id": "heading",
      "label": "t:sections.faq_v2.settings.heading.label",
      "default": "Hello new you <br> Beauty",
      "info": "Enter <br> for a line break"
    },
    {
      "type": "text",
      "id": "desc",
      "label": "t:sections.faq_v2.settings.desc.label",
      "default": "Buy natural, sustainable and chemicalfree products from local sellers across the country."
    },
    {
      "type": "header",
      "content": "t:sections.all.heading.content"
    },
    {
      "type": "color_scheme",
      "id": "color_scheme",
      "label": "t:sections.all.color_scheme.label"
    },
    {
      "type": "color",
      "id": "background_color",
      "label": "t:sections.all.bg_color.label"
    },
    {
      "type": "color_background",
      "id": "background_gradient",
      "label": "t:sections.all.bg_gradient.label"
    },
    {
      "type": "number",
      "id": "padding_top",
      "label": "t:sections.all.padding_top.label",
      "default": 50
    },
    {
      "type": "number",
      "id": "padding_bottom",
      "label": "t:sections.all.padding_bottom.label",
      "default": 50
    }
  ],
  "presets": [
    {
      "name": "t:sections.faq_v2.presets.name"
    }
  ]
}
{% endschema %}
