{#
Copyright 2024, 2025 New Vector Ltd.
Copyright 2022-2024 The Matrix.org Foundation C.I.C.

SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
-#}

{% macro button(text, csrf_token, as_link=false, post_logout_action={}) %}
  <form method="POST" action="{{ "/logout" | prefix_url }}" class="inline-flex">
    <input type="hidden" name="csrf" value="{{ csrf_token }}" />
    {% for key, value in post_logout_action|items %}
      <input type="hidden" name="{{ key }}" value="{{ value }}" />
    {% endfor %}
    {% if as_link %}
      <button class="cpd-link flex-1" data-kind="critical" type="submit">{{ text }}</button>
    {% else %}
      <button class="cpd-button destructive flex-1" data-kind="secondary" data-size="lg" type="submit">{{ text }}</button>
    {% endif %}
  </form>
{% endmacro %}
