{# templates/components/Modal.html.twig #}
<div
    {{ attributes }}
    data-controller="modal"
    data-modal-open-trigger-value="{{ openTrigger }}"
    data-modal-close-trigger-value="{{ closeTrigger }}"
    {% if modalId is defined %}id="{{ modalId }}"{% endif %}
>
    <div data-modal-target="modal" class="fixed inset-0 z-50 overflow-y-auto hidden" aria-labelledby="modal-title" role="dialog" aria-modal="true">
        <div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
            {# Backdrop #}
            <div data-action="click->modal#close" class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden="true"></div>

            {# Centrage vertical trick #}
            <span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>

            {# Modal panel #}
            <div {% if stimulus is defined %} data-controller="{{ stimulus }}" {% endif %} class="inline-block align-bottom bg-white rounded-sm text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle {{ modalClass|default('sm:max-w-lg') }} sm:w-full">
                <div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
                    <h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title">
                        {{ title }}
                    </h3>
                    <div class="mt-2">
                        {{ block('content') }}
                    </div>
                </div>
                <div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
                    {{ block('footer') }}
                </div>
            </div>
        </div>
    </div>
</div>
