{# LIBRARIES #}
{{ attach_library('ui_patterns/social_share.social_share_lib') }}

{# VARIABLES #}
{% set style = style|default('links') %}
{% set wrapper_class = [
  wrapper_class,
  'social-' ~ style,
] %}

{# TEMPLATE #}
{% if links %}
  <div class='{{ wrapper_class|join(' ') }}'>
    {% for link in links %}

      {% set link_text %}

        {% if style == 'links' %}
          <i class='{{ link.fa_family|default('fab') }} {{ link.icon_links }}'></i>
          <span class='sr-only'>{{ link.share }} us on {{ link.title }}</span>
        {% endif %}

        {% if style == 'share' %}
          <i class='{{ link.fa_family|default('fab') }} {{ link.icon_share }}'></i>
          <span>{{ link.share }}</span>
        {% endif %}

      {% endset %}

      {% include "@atoms/tm-links/standard/standard.twig" with {
        "text": link_text,
        "url": link.url,
        "class": link.class,
        "attributes": link.attr|default(create_attribute()),
      } only %}

    {% endfor %}
  </div>
{% endif %}
