{% set type_mapping = {'info':'success', 'error': 'error', 'warning': 'warning'} %}
{% set icon_mapping = {'info':'circle-check', 'error':'circle-xmark', 'warning':'circle-info'} %}

{% if grav.messages.all %}
    <div id="messages">
    {% for message in grav.messages.fetch %}
        {% set scope = message.scope|e %}
        {% set type = type_mapping[scope] %}
        {% set icon = icon_mapping[scope] %}
        <div class="toast toast-{{ type }} {{ scope }}">
            <i class="fa-solid fa-{{ icon }}" aria-hidden="true"></i>
            <span>{{ message.message|raw }}</span>
        </div>
    {% endfor %}
    </div>
{% endif %}
