{# Define icon variables #}
{% set icon_path = '@siteimprove_accessibility/components/alfa_scan_button/images' %}
{% set icon_name = 'FAB' %}

{# Define main container classes #}
{% set classes = ['floating-si'] %}

{# Define button classes conditionally #}
{% set alfa_scan_button_classes = ['alfa-scan-button hidden'] %}
{% if isPreview and previewAutoScan %}
  {% set alfa_scan_button_classes = alfa_scan_button_classes|merge(['preview-autoscan']) %}
{% endif %}

<div {{ attributes.addClass(classes) }}>
  <div class="alfa-scan-block-wrapper">

    {# Scan button #}
    <button {{ create_attribute().addClass(alfa_scan_button_classes).setAttribute('data-observe-key', 'a11y-Drupal-ScanButton') }}>
      {{ include(icon_path ~ '/' ~ icon_name ~ '.svg') }}
    </button>

    <div class="alfa-scan-throbber hidden">
      <div class="spinner"></div>
    </div>

    {# Scan report block #}
    <div class="alfa-scan-report">
      <div class="spr-heading-wrapper-flex alfa-scan-close">
        <span>{{ 'Siteimprove Accessibility'|t }}</span>
        <span>{{ include(icon_path ~ '/Button.svg') }}</span>
      </div>
      <div class="spr-wrapper">
        <div id="single-page-reporting"></div>
      </div>
    </div>

  </div>
</div>
