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

{% block stylesheets %}
<style>
{% if particle.particle_title_color or particle.particle_title_fontsize %}
#{{ id }}.g5-particle-title { {% if particle.particle_title_color %}color: {{ particle.particle_title_color }};{% endif %}{% if particle.particle_title_fontsize %}font-size: {{particle.particle_title_fontsize}}px;{% endif %} }
{% endif %}
#{{ id }} .jl-iconnav > * > a { text-align: center; line-height: 36px;}
</style>
{% endblock %}

{% block javascript_footer %}
    {% do gantry.document.addScript(url('gantry-theme://js/sharer.min.js')) %}
{% endblock %}

{# set Animation #}
{% set animation %}
{% if particle.animation != 'inherit' %} jl-scrollspy="cls: jl-animation-{{particle.animation|e}};{% if particle.animation_repeat == 'enabled' %} repeat: true;{% endif %}{% if particle.animation_delay %} delay: {{particle.animation_delay|e}};{% endif %}"{% endif %}
{% endset %}

{# Set Max-Width Content #}
{% set content_maxwidth %}
{% if particle.g_maxwidth != 'inherit' %} jl-width-{{particle.g_maxwidth}}{% if particle.g_maxwidth_breakpoint != 'always' %}@{{particle.g_maxwidth_breakpoint}}{% endif %}{% if particle.g_maxwidth_alignment == 'left' %}{% elseif particle.g_maxwidth_alignment == 'center' %} jl-margin-auto{% else %} jl-margin-auto-left{% endif %}{% endif %}
{% endset %}

{# Set Particle Alignment #}
{% set particle_alignment %}
{% if particle.align != 'inherit' %} jl-text-{{particle.align|e}}{% if particle.breakpoint != 'always' %}@{{particle.breakpoint|e}}{% endif %}{% endif %}{% if particle.align != 'inherit' and particle.breakpoint != 'always' %}{% if particle.fallback != 'inherit' %} jl-text-{{particle.fallback|e}}{% endif %}{% endif %}
{% endset %}

{# set Particle Title Style #}
{% set particle_title_style %}
{% if particle.particle_title %}
<{{particle.particle_title_element|e}} id="{{ id }}" class="g5-particle-title{% if particle.particle_title_align != 'inherit' %} jl-text-{{particle.particle_title_align|e}}{% endif %}{% if particle.particle_predefined_color != 'default' %} jl-text-{{particle.particle_predefined_color|e}}{% endif %}{% if particle.particle_title_style != 'default' %} jl-{{particle.particle_title_style|e}}{% endif %}{% if particle.particle_title_decoration != 'none' %} jl-heading-{{particle.particle_title_decoration|e}}{% endif %}">
{% if particle.particle_title_decoration == 'line' %} <span>{{particle.particle_title|raw}}</span>
{% else %} {{particle.particle_title|raw}}
{% endif %}
</{{particle.particle_title_element|e}}>
{% endif %}
{% endset %}

{% set datawidth = particle.datawidth ? ' data-width="' ~ particle.datawidth ~ '"' %}
{% set dataheight = particle.dataheight ? ' data-height="' ~ particle.dataheight ~ '"' %}

{# Set Item Content #}
{% set icon_list %}
{% for item in particle.items %}

{% set twitter_hashtags %}
{% if particle.twitter_hashtags and item.network == 'twitter' %} data-hashtags="{{ particle.twitter_hashtags }}"{% endif %}
{% endset %}

{% set facebook_hashtags %}
{% if particle.facebook_hashtags and item.network == 'facebook' %} data-hashtags="{{ particle.facebook_hashtags }}"{% endif %}
{% endset %}

{% set email_attr %}
{% if particle.email_datasubject and item.network == 'mail' %} data-subject="{{ particle.email_datasubject|e }}"{% endif %}
{% if particle.email_datato and item.network == 'mail' %} data-to="{{ particle.email_datato|e }}"{% endif %}
{% endset %}

{% set telegram_data %}
{% if particle.telegram_data and item.network == 'telegram' %} data-to="{{ particle.telegram_data }}"{% endif %}
{% endset %}

<li class="tm-share-icon">
  <a class="{{item.network}}{% if particle.button %} jl-icon-button{% endif %} fa{% if item.network == 'mail' %} fa-envelope-o{% else %} fa-{{item.network}}{% endif %}" {% if item.network == 'mail' %} data-sharer="email"{% else %} data-sharer="{{item.network}}"{% endif %}{% if item.network == 'twitter' or item.network == 'whatsapp' or item.network == 'mail' or item.network == 'telegram' or item.network == 'tumblr' or item.network == 'vk' or item.network == 'xing' or item.network == 'digg' or item.network == 'weibo' or item.network == 'renren' or item.network == 'skype' %} data-title="{{item.data_title}}"{% endif %}{{twitter_hashtags|raw}}{{facebook_hashtags|raw}}{{datawidth|raw}}{{dataheight|raw}} data-url="{{ gantry.page.url }}"{{email_attr|raw}}{{telegram_data}}{% if particle.tooltip %} jl-tooltip="title: {{item.data_title}}"{% endif %}></a>
</li>
{% endfor %}
{% endset %}

{% block particle %}
{% if particle.enabled %}
{{particle_title_style}}
<div id="{{ id }}" class="tm-content-wrapper{{content_maxwidth}}{% if particle.class %} {{ particle.class }}{% endif %}{{particle_alignment}}{% if particle.margin == 'inherit' %}{% elseif particle.margin == 'default' %} jl-margin{% else %} jl-margin-{{particle.margin|e}}{% endif %}{% if particle.visibility != 'inherit' %} jl-visible@{{particle.visibility|e}}{% endif %}"{{animation}}>
{% if particle.button_style != 'default' %}
<div class="tm-social-share">
  <a href="#" class="jl-icon-button"><i class="fa fa-share-alt" aria-hidden="true"></i></a>
    <div class="jl-width-1-1@l" jl-drop="pos: {{particle.hover_position}};{% if particle.hover_animation != 'inherit' %}animation: jl-animation-{{particle.hover_animation}}; duration: 1000;{% endif %}boundary: .tm-social-share; mode: {% if particle.button_style == "showall" %}hover{% else %}click{% endif %}">
      <ul class="jl-iconnav{% if particle.icon_style != 'default' %} tm-custom-icon{% endif %}{% if particle.vertical_button %} jl-iconnav-vertical{% endif %}">
      {{icon_list}}
      </ul>
    </div>
</div>
{% else %}
<ul class="jl-iconnav{% if particle.icon_style != 'default' %} tm-custom-icon{% endif %}{% if particle.vertical_button %} jl-iconnav-vertical{% endif %}" jl-margin>
  {{icon_list}}
</ul>
{% endif %}
</div>
{% endif %}
{% endblock %}
