{#
/**
 * @file
 * FlowDrop Action Link Component
 *
 * A clickable card for navigation actions in dashboards.
 *
 * Available variables:
 * - title: The action title (required)
 * - description: Optional description
 * - url: The link destination (required)
 * - icon: Optional SVG icon markup
 * - badge: Optional count badge
 * - external: Whether this is an external link
 */
#}

{% set external = external|default(false) %}
{% set link_attrs = external ? {'target': '_blank', 'rel': 'noopener noreferrer'} : {} %}

<a href="{{ url }}"{{ create_attribute(link_attrs) }} class="fd-action-link">
  {% if icon %}
    <div class="fd-action-link__icon">
      {{ icon|raw }}
    </div>
  {% endif %}
  
  <div class="fd-action-link__content">
    <div class="fd-action-link__header">
      <span class="fd-action-link__title">{{ title }}</span>
      {% if badge is not null and badge is not same as(false) %}
        <span class="fd-action-link__badge">{{ badge }}</span>
      {% endif %}
    </div>
    {% if description %}
      <p class="fd-action-link__description">{{ description }}</p>
    {% endif %}
  </div>
  
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="fd-action-link__arrow">
    {% if external %}
      <path fill-rule="evenodd" d="M5.22 14.78a.75.75 0 001.06 0l7.22-7.22v5.69a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75h-7.5a.75.75 0 000 1.5h5.69l-7.22 7.22a.75.75 0 000 1.06z" clip-rule="evenodd" />
    {% else %}
      <path fill-rule="evenodd" d="M3 10a.75.75 0 01.75-.75h10.638L10.23 5.29a.75.75 0 111.04-1.08l5.5 5.25a.75.75 0 010 1.08l-5.5 5.25a.75.75 0 11-1.04-1.08l4.158-3.96H3.75A.75.75 0 013 10z" clip-rule="evenodd" />
    {% endif %}
  </svg>
</a>


