{% extends '@nucleus/partials/particle.html.twig' %}

{% if particle.target %}
    {% set targetAttrib = ' target="' ~ particle.target|e ~ '"' %}
    {% set targetAttrib = (particle.target == '_blank') ? targetAttrib ~ ' rel="noopener noreferrer"' : targetAttrib %}
{% endif %}

{% block particle %}
    {% if particle.title %}<h2 class="g-title">{{ particle.title|raw }}</h2>{% endif %}
    <div class="g-social {{ particle.css.class }}">
        {% for item in particle.items %}
            {% set title = (item.title is not empty) ? item.title|e : item.text|e %}
            {% set titleAttrib = (title is not empty) ? ' title="' ~ title ~ '" aria-label="' ~ title ~ '"' : '' %}
            <a href="{{ item.link|e }}"{{ targetAttrib|raw }}{{ titleAttrib|raw }}>
                {% if particle.display in ['both', 'icons_only'] %}<span class="{{ item.icon|e }}"></span>{% endif %}
                {% if particle.display in ['both', 'text_only'] %}<span class="g-social-text">{{ item.text|e }}</span>{% endif %}
            </a>
        {% endfor %}
    </div>
{% endblock %}
