{% macro atomV1ButtonCss(buttonDesignSection, className, selectorPrefix, breakpoint, globalSettings) %}
    {% if buttonDesignSection.style == 'text' or (buttonStyle == 'text' and buttonDesignSection.style is empty) %}
        {{ _self.atomV1ButtonAsLinkCss(buttonDesignSection.text, selectorPrefix ~ ' .' ~ className, globalSettings) }}
    {% elseif buttonDesignSection.style == 'custom' and buttonDesignSection.custom_type != 'preset' %}
        {{ _self.atomV1ButtonButton(buttonDesignSection.custom, selectorPrefix ~ ' .' ~ className, "custom", breakpoint, globalSettings) }}
    {% endif %}
{% endmacro %}

{# "Disabled" is used to disable the form builder button when on free mode #}
{% macro atomV1ButtonHtmlManual(text, link, className, designProps, buttonStyle, buttonId = '', isSubmit = false, contentEditablePath = '', disabled = false) %}

    {% if buttonStyle in ['primary', 'secondary', 'custom', 'text'] %}
        {% if designProps.style is empty %}
            {% set buttonStyleClass = 'button-atom--' ~ buttonStyle %}
        {% else %}
            {% set buttonStyleClass = 'button-atom--' ~ designProps.style %}
        {% endif %}
    {% else %}
        {% if designProps.style is empty %}
            {% set buttonStyleClass = 'button-atom--primary' %}
        {% else %}
            {% set buttonStyleClass = 'button-atom--' ~ designProps.style %}

            {% if designProps.preset and designProps.style == 'custom' and designProps.custom_type == 'preset' %}
                {% set buttonStyleClass = buttonStyleClass ~ ' button-atom--preset-' ~ designProps.preset %}
            {% endif %}
        {% endif %}
    {% endif %}

    {% if link.html.id %}
      {% set buttonId = link.html.id %}
    {% endif %}

    {% set cssClasses = [
        'button-atom',
        buttonStyleClass,
        className
    ]|join(" ") %}

    {% set attrs = '' %}

    {% for attribute in link.html.attributes %}
      {% if attribute.name %}
        {% set attrs = attrs ~ ' ' ~ attribute.name ~ '="' ~ attribute.value ~ '"' %}
      {% endif %}
    {% endfor %}

    {% set maybeUrl = _self.getUntrimmedLinkUrl(link)|trim %}
    {% set linkTypes = ['lightbox', 'contact', 'action'] %}
    {% set isButton = maybeUrl is empty and link.type not in linkTypes %}

    {% if isButton %}
        <button type="{{ isSubmit ? "submit" : "button" }}" class="{{ cssClasses }}"{{ buttonId ? ' id="'~ buttonId ~'"' }} {{ disabled ? "disabled" : '' }} {{ attrs }}>
    {% else %}
        {{ _self.linkStart(link, cssClasses, '', false) }}
    {% endif %}

        <span class="button-atom__text"{{ dataContentEditablePropertyPath(contentEditablePath) }}>{{ text|default('Click Here') }}</span>

        {% if designProps.custom.icon.icon and designProps.style != 'text' %}
            {% set iconSvgCode = designProps.custom.icon.icon.svgCode %}
        {% endif %}

        {% if designProps.style == 'text' and designProps.text.arrow.arrow %}
            {{ _self.atomV1ButtonLinkIconHtml(designProps.text.arrow) }}
        {% endif %}

    {% if isButton %}
        </button>
    {% else %}
        {{ _self.linkEnd() }}
    {% endif %}
{% endmacro %}

{% macro atomV1ButtonHtml(buttonContentSection, className, designProps, contentEditablePath, buttonStyle) %}
    {{ _self.atomV1ButtonHtmlManual(buttonContentSection.text, buttonContentSection.link, className, designProps, buttonStyle, '', false, contentEditablePath) }}
{% endmacro %}



