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

<section {% render 'section-attr' %}>
  <div class='faq-v1' style='background: {{section.settings.faq_bg }}'>
    <xo-container {% render 'section-layout-2' %}>
      <xo-grid>
        <div
          style='
                {% if section.settings.reverse_layout %}
              --xs: 12; --order-xs: 2; --sm: 6; --order-sm: 2; --lg: 6; --order-lg: 2;
            {% else %}
              --xs: 12; --order-xs: 2; --sm: 6; --order-sm: 1; --lg: 6;
                  {% endif %}
          '
        >
          <div class='faq-v1-left'>
            {%- render 'image', image: section.settings.faq_img -%}
          </div>
        </div>

        <div
          style='
              {% if section.settings.reverse_layout %}
              --xs: 12; --order-xs: 2;--sm: 6; --order-sm: 1; --lg: 6;
              {% else %}
              --xs: 12; --order-xs: 1;--sm: 6; --order-sm: 2; --lg: 6;
            {% endif %}
          '
        >
          <div class='faq-v1-right'>
            <div class='faq-v1-right__heading'>
              {%- if section.settings.sub != blank -%}
                <div class='faq-v1-right__sub'>{{ section.settings.sub }}</div>
              {%- endif -%}
              {%- if section.settings.heading -%}
                <h2 class='faq-v1-right__title'>{{ section.settings.heading }}</h2>
              {%- endif -%}
            </div>

            <div class='faq-v1-right__provider xo-scrollbar'>
              <xo-collapse-provider xo-duration='300'>
                {%- for block in section.blocks -%}
                  <div class='faq-v1-right__row'>
                    {%- if block.settings.question != blank -%}
                      <xo-collapse-trigger class='faq-v1-right__trigger'>
                        <div class='faq-v1-right__question'>{{ block.settings.question }}</div>
                        <div class='faq-v1-right__plus'>
                          {%- render 'icon', name: 'plus2', icon_size: '15', color: 'rgba(var(--color-foreground))' -%}
                        </div>
                      </xo-collapse-trigger>
                    {%- endif -%}
                    {%- if block.settings.anwser != blank and block.settings.question != blank -%}
                      <xo-collapse>
                        <div class='faq-v1-right__anwser'>{{ block.settings.anwser }}</div>
                      </xo-collapse>
                    {%- endif -%}
                  </div>
                {%- endfor -%}
              </xo-collapse-provider>
            </div>
          </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": "header",
      "content": "Settings layout"
    },
    {
      "type": "select",
      "id": "section-layout-2-width",
      "label": "t:sections.all.section-layout-2-width.label",
      "default": "box",
      "options": [
        {
          "value": "box",
          "label": "t:sections.all.section-layout-2-width.options__1.label"
        },
        {
          "value": "fullwidth",
          "label": "t:sections.all.section-layout-2-width.options__2.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": "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 %}
