<section class="ridge-dispatch" data-reveal>
  <div class="container">
    <div class="ridge-dispatch__layout">
      <div class="ridge-dispatch__content">
        {%- if section.settings.eyebrow != blank -%}
          <span class="section-eyebrow">{{ section.settings.eyebrow }}</span>
        {%- endif -%}
        {%- if section.settings.heading != blank -%}
          <h2 class="section-heading">{{ section.settings.heading }}</h2>
        {%- endif -%}
        {%- if section.settings.text != blank -%}
          <p class="ridge-dispatch__text">{{ section.settings.text }}</p>
        {%- endif -%}
      </div>
      <div class="ridge-dispatch__form-col">
        {%- form 'customer', id: 'ridge-dispatch-form' -%}
          <input type="hidden" name="contact[tags]" value="ridge-dispatch">
          <div class="ridge-dispatch__field">
            <input type="email" name="contact[email]" class="ridge-dispatch__input" placeholder="{{ section.settings.placeholder | default: 'Your email address' }}" required aria-label="Email address">
            <button type="submit" class="btn btn--primary ridge-dispatch__btn">{{ section.settings.button_text | default: 'Sign Up' }}</button>
          </div>
          {%- if form.posted_successfully? -%}
            <p class="ridge-dispatch__success" role="status">{{ section.settings.success_message | default: 'Welcome to the ridge.' }}</p>
          {%- endif -%}
        {%- endform -%}
      </div>
    </div>
  </div>
</section>

{% schema %}
{
  "name": "Ridge Dispatch",
  "class": "section-ridge-dispatch",
  "settings": [
    { "type": "text", "id": "eyebrow", "label": "Eyebrow", "default": "JOIN THE RIDGE" },
    { "type": "text", "id": "heading", "label": "Heading", "default": "Get the Dispatch" },
    { "type": "textarea", "id": "text", "label": "Description" },
    { "type": "text", "id": "placeholder", "label": "Email placeholder", "default": "Your email address" },
    { "type": "text", "id": "button_text", "label": "Button text", "default": "Sign Up" },
    { "type": "text", "id": "success_message", "label": "Success message", "default": "Welcome to the ridge. Check your inbox." }
  ],
  "presets": [{ "name": "Ridge Dispatch" }]
}
{% endschema %}