{#
Copyright 2021-2023 The Matrix.org Foundation C.I.C.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#}

{% macro link(text, href="#", class="") %}
  <a class="cpd-button {{ class }}" data-kind="primary" data-size="lg" href="{{ href | prefix_url }}">{{ text }}</a>
{% endmacro %}

{% macro link_text(text, href="#", class="") %}
  <a class="cpd-link {{ class }}" data-kind="primary" href="{{ href | prefix_url }}">{{ text }}</a>
{% endmacro %}

{% macro link_outline(text, href="#", class="") %}
  <a class="cpd-button {{ class }}" data-kind="secondary" data-size="lg" href="{{ href | prefix_url }}">{{ text }}</a>
{% endmacro %}

{% macro button(
  text,
  name="",
  type="submit",
  class="",
  value="",
  disabled=False,
  autocomplete=False,
  autocorrect=False,
  autocapitalize=False) %}
  <button
    name="{{ name }}"
    value="{{ value }}"
    type="{{ type }}"
    {% if disabled %}disabled{% endif %}
    class="cpd-button {{ class }}"
    data-kind="primary"
    data-size="lg"
    {% if autocapitalize %}autocapitilize="{{ autocapitilize }}"{% endif %}
    {% if autocomplete %}autocomplete="{{ autocomplete }}"{% endif %}
    {% if autocorrect %}autocorrect="{{ autocorrect }}"{% endif %}
  >{{ text }}</button>
{% endmacro %}

{% macro button_text(
  text,
  name="",
  type="submit",
  class="",
  value="",
  disabled=False,
  autocomplete=False,
  autocorrect=False,
  autocapitalize=False) %}
  <button
    name="{{ name }}"
    value="{{ value }}"
    type="{{ type }}"
    {% if disabled %}disabled{% endif %}
    data-kind="primary"
    class="cpd-link {{ class }}"
    {% if autocapitalize %}autocapitilize="{{ autocapitilize }}"{% endif %}
    {% if autocomplete %}autocomplete="{{ autocomplete }}"{% endif %}
    {% if autocorrect %}autocorrect="{{ autocorrect }}"{% endif %}
  >{{ text }}</button>
{% endmacro %}

{% macro button_outline(
  text,
  name="",
  type="submit",
  class="",
  value="",
  disabled=False,
  autocomplete=False,
  autocorrect=False,
  autocapitalize=False) %}
  <button
    name="{{ name }}"
    value="{{ value }}"
    type="{{ type }}"
    class="cpd-button {{ class }}"
    data-kind="secondary"
    data-size="lg"
    {% if disabled %}disabled{% endif %}
    {% if autocapitalize %}autocapitilize="{{ autocapitilize }}"{% endif %}
    {% if autocomplete %}autocomplete="{{ autocomplete }}"{% endif %}
    {% if autocorrect %}autocorrect="{{ autocorrect }}"{% endif %}
  >{{ text }}</button>
{% endmacro %}
