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

<section {% render 'section-attr', style: '--pb-mobile: 70px' %}>
  <div class='faq-v3'>
    <xo-container {% render 'section-layout-2' %}>
      <xo-grid style='--xs: 1; --sm: 1; --xl: 1'>
        <div>
          <div class='faq-v3__heading'>
            {%- if section.settings.sub != blank -%}
              <div class='faq-v3__sub'>{{ section.settings.sub }}</div>
            {%- endif -%}
            {%- if section.settings.heading -%}
              <h2 class='faq-v3__title'>{{ section.settings.heading }}</h2>
            {%- endif -%}
          </div>
          <xo-collapse-provider xo-duration='300'>
            {%- for block in section.blocks -%}
              <div class='faq-v3-right__row'>
                {%- if block.settings.question != blank -%}
                  <xo-collapse-trigger class='faq-v3-right__trigger'>
                    <div class='faq-v3-right__question'>{{ block.settings.question }}</div>
                    <div class='faq-v3-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-v3-right__anwser'>{{ block.settings.anwser }}</div>
                  </xo-collapse>
                {%- endif -%}
              </div>
            {%- endfor -%}
          </xo-collapse-provider>
        </div>
      </xo-grid>
    </xo-container>
  </div>
</section>

{% schema %}
{
  "name": "t:sections.faq_v3.name",
  "tag": "section",
  "class": "section",
  "blocks": [
    {
      "type": "question",
      "name": "t:sections.faq_v3.blocks.question.name",
      "settings": [
        {
          "type": "text",
          "id": "question",
          "label": "t:sections.faq_v3.blocks.question.settings.title.label",
          "default": "t:sections.faq_v3.blocks.question.settings.title.default"
        },
        {
          "type": "richtext",
          "id": "anwser",
          "label": "t:sections.faq_v3.blocks.question.settings.content.label",
          "default": "t:sections.faq_v3.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_v3.settings.content.label"
    },
    {
      "type": "text",
      "id": "sub",
      "label": "t:sections.faq_v3.settings.sub.label",
      "default": "ask us anything"
    },
    {
      "type": "text",
      "id": "heading",
      "label": "t:sections.faq_v3.settings.heading.label",
      "default": "frequently asked <br> questions",
      "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_v3.presets.name"
    }
  ]
}
{% endschema %}
