{% props href = null, method = 'get', csrf_token = null, active = false %}
{% set inner %}{% block content %}{% endblock %}{% endset %}

{% set classes = 'group flex items-center mx-1 my-0.5 border-0 rounded-md px-2 py-1.5 text-sm leading-5' %}
{% if active %}
    {% set classes = classes ~ ' font-medium text-gray-900 dark:text-white cursor-default' %}
{% else %}
    {% set classes = classes ~ ' text-gray-700 dark:text-gray-100/70 hover:bg-gray-100 dark:hover:bg-gray-900 hover:text-gray-900 dark:hover:text-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-900' %}
{% endif %}

{% if active %}
    <a {{ attributes.defaults({ class: classes }) }}>{{ inner|raw }}</a>
{% elseif method|lower == 'post' %}
    <form action="{{ href }}" method="post" class="block w-full">
        <input type="hidden" name="_token" value="{{ csrf_token('submit') }}">
        <button type="submit" {{ attributes.defaults({ class: 'w-full cursor-pointer ' ~ classes }) }}>{{ inner|raw }}</button>
    </form>
{% elseif href %}
    <a href="{{ href }}" {{ attributes.defaults({ class: classes }) }}>{{ inner|raw }}</a>
{% else %}
    <button type="button" {{ attributes.defaults({ class: 'w-full cursor-pointer ' ~ classes }) }}>{{ inner|raw }}</button>
{% endif %}
