{# API #}
{%- set props = props | default([]) -%}
{%- set _color = props.color | default('primary') -%}
{%- set _hasVisitedStyleAllowed = props.hasVisitedStyleAllowed | default(false) -%}
{%- set _href = props.href -%}
{%- set _isDisabled = props.isDisabled | default(false) -%}
{%- set _underlined = props.underlined | default('hover') -%}

{# Variables #}
{%- set rootUnderlinedClassName = '' %}

{# Class names #}
{%- set _colorClassName = _spiritClassPrefix ~ 'link-' ~ _color -%}
{%- set _rootDisabledClassName = _isDisabled ? _spiritClassPrefix ~ 'link-disabled' : null -%}
{%- if _underlined is same as('always') %}
    {%- set rootUnderlinedClassName = _spiritClassPrefix ~ 'link-underlined' -%}
{% elseif _underlined is same as('never') %}
    {%- set rootUnderlinedClassName = _spiritClassPrefix ~ 'link-not-underlined' -%}
{% endif %}
{%- set _rootAllowVisitedStyleClassName = _hasVisitedStyleAllowed ? _spiritClassPrefix ~ 'link-allow-visited-style' : null -%}

{# Miscellaneous #}
{%- set _styleProps = useStyleProps(props) -%}
{%- set _classNames = [ _colorClassName, _rootDisabledClassName, rootUnderlinedClassName, _rootAllowVisitedStyleClassName, _styleProps.className ] -%}
{%- set _allowedAttributes = [ 'target', 'title' ] -%}
<a
    {{ mainProps(props, _allowedAttributes) }}
    href="{{ _href }}"
    {{ styleProp(_styleProps) }}
    {{ classProp(_classNames) }}
>
    {%- block content %}{% endblock %}
</a>
