{%- set class_name = [
"link",
"d-inline-flex align-items-center gap-1",
props.color in ['black', 'primary', 'primary-only', 'primary-to-conversion'] ? '--' ~ props.color : "",
props.icon_before == true ? '--icon-before' : null,
props.animation in ["right", "zoom"] ? "--animation-" ~ props.animation : null,
props.underline_initial ? "--underline-initial" : null,
props.extra_class|default(false) ? props.extra_class : null
]|join(' ')|trim -%}
{%- set attrs = [
'class="' ~ class_name ~ '"'
] -%}
{%- set attrs = attrs|merge(['href="' ~ props.url|default("#") ~ '"']) -%}
{%- if props.blank %}
{%- set attrs = attrs|merge(['target="_blank"']) -%}
{%- endif -%}
{%- if props.title is defined %}
{%- set attrs = attrs|merge(['title="' ~ props.title ~ '"']) -%}
{%- endif -%}
{%- if props.onclick is defined %}
{%- set attrs = attrs|merge(['onclick="' ~ props.onclick ~ '"']) -%}
{%- endif -%}
{%- if props.data is defined -%}
{%- set data_attrs = [] -%}
{%- for key, attribute in props.data -%}
{%- set data_attrs = data_attrs|merge(['data-' ~ key ~ '="' ~ attribute ~ '"']) -%}
{%- endfor -%}
{%- set data_attrs = data_attrs|join(' ')|trim -%}
{%- set attrs = attrs|merge([data_attrs]) -%}
{%- endif -%}
{%- set attrs = attrs|join(' ')|trim -%}
<a {{ attrs|raw }}>
<span class="link__title">{{ props.title }}</span>
{% if props.icon %}
<span class="link__icon d-flex align-items-center justify-content-center flex-shrink-0">
{% include "@Components/icon/icon.twig" with {props: props.icon|merge({color: props.color ?? null})} %}
</span>
{% endif %}
</a>