{{ attach_library('ui_patterns/routes_journey_information.routes_journey_information_lib') }}

{% set button_attributes = button_attributes|default(create_attribute())
  .setAttribute("data-from-station", origin_crs)
  .setAttribute("data-to-station", destination_crs)
%}

{% set odd_even = items|length % 2 ? 'even' : 'odd' %}

<div class="sticky-info">
  <dl class="journey-information-list">
    {% for item in items %}
      {% if item.key == 'prices_from' %}
        <div class="info-block info-cta {{ odd_even }}">
          <dt class="property">{{ price_text }}</dt>
          <dd class="value">£{{ price }}
            <span class="note">{{ journey_type_text }}</span>
            {% if return_fare_text %}
              <span class="note extra">{{ return_fare_text }}</span>
            {% endif %}
            {% include '@atoms/form/button/button.twig' with {
              'text': button_text,
              'status': 'default',
              'class': 'book-button buy-tickets-btn',
              'size': 'btn-sm',
              'attributes': button_attributes
            } only %}
          </dd>
        </div>
      {% else %}
        <div class="info-block">
          <dt class="property">
            {% if item.icon != '_none' %}
              {% set icons = item.icon|split('|') %}
              <span class="icons" aria-hidden="true">
                {% for icon in icons %}
                  <i class="fal {{ icon }}"></i>
                {% endfor %}
              </span>
            {% endif %}
            <span>{{ item.label }}</span>
          </dt>
          <dd class="value">{{ item.value }}</dd>
        </div>
      {% endif %}
    {% endfor %}
  </dl>
</div>