{% liquid
  assign section_name = 'Block Text'
  assign el_id = section_name | handle | append: '-' | append: section.id

  assign section_padding = section.settings.padding
  assign padding_class = 'sp-' | append: section_padding
  if section.settings.top_half_padding
    assign padding_class = padding_class | append: ' spt-' | append: section_padding | append: '-half'
  endif
  if section.settings.bottom_half_padding
    assign padding_class = padding_class | append: ' spb-' | append: section_padding | append: '-half'
  endif
  if section.settings.bg_overlay
    assign bg_overlay = 'bg-overlay'
  endif
%}

<style>
  #{{ el_id }} .image-con {
    width: 32px;
    height: 32px;
  }
</style>


<div id="{{ el_id }}" class="{{ padding_class }} {{ bg_overlay }}">
  <div class="container">
      {% if section.blocks.size > 0 %}
        <div class="flex flex-column ai-center jc-center rowgap-40 d-flex-row colgap-100">
        {% for block in section.blocks %}
          <div class="max-260 flex flex-column ai-center jc-center tc">
              {% if block.settings.image != blank %}
                <div class="image-con pb-10">
                  {% assign image_alt = block.settings.title |  escape %}
                  {% render 'global-image-wrapper' image: block.settings.image, image_alt: image_alt, additional_class: 'no-bg' %}
                  </div>
                {% endif %}
                {% if block.settings.title != blank %}
                  <div class="p3 pb-15 bold-500">{{ block.settings.title }}</div>
                {% endif %}
                {% if block.settings.text != blank %}
                  <div class="p3 pb-10">{{ block.settings.text }}</div>
                  
                {% endif %}
                {% if block.settings.link_label != blank %}
                  <a href="{{ block.settings.link_url }}" class="link1 uppercase">
                    {{- block.settings.link_label -}}
                  </a>
                {% endif %}
                
                </div>
          {% endfor %}
              </div>
    {% endif %}
        
    </div>
</div>
{% schema %}
    {
      "name": "Block Text",
      "settings": [
        {
          "type": "header",
          "content": "Section Padding"
        },
        {
          "type": "select",
          "id": "padding",
          "label": "Padding",
          "options": [
            {
              "value": "no",
              "label": "No"
            },
            {
              "value": "sm",
              "label": "Small"
            },
            {
              "value": "md",
              "label": "Med"
            },
            {
              "value": "lg",
              "label": "Large"
            }
          ],
          "default": "md"
        },
        {
          "type": "checkbox",
          "id": "top_half_padding",
          "label": "Top half padding",
          "default": false
        },
        {
          "type": "checkbox",
          "id": "bottom_half_padding",
          "label": "Bottom half padding",
          "default": false
        },
        {
          "type": "header",
          "content": "General Settings"
        },
        {
            "type": "checkbox",
            "id": "bg_overlay",
            "label": "Background Overlay",
            "default": false

        }
      ],
      "blocks": [
        {
          "type": "block",
          "name": "Block",
    
          "settings": [
            {
              "type": "text",
              "id": "title",
              "label": "Title"
            },
    
            {
              "type": "image_picker",
              "id": "image",
              "label": "Icon"
            },
            {
              "type": "textarea",
              "id": "text",
              "label": "text"
            },
            {
              "type": "text",
              "id": "link_label",
              "label": "Link Label"
            },
            {
              "type": "url",
              "id": "link_url",
              "label": "Link URL"
            }
          ]
        }
      ],
      "presets": [
        {
          "name": "Block Text",
          "blocks": []
        }
      ]
    }
    {% endschema %}
    