alert.ftl

 1   <#--
 2   Macro: alert
 3   
 4   Description: Generates an HTML alert element with optional title, icon, and dismiss button.
 5   
 6   Parameters:
 7   - class (string, optional): the CSS class of the alert element.
 8   - color (string, optional): the background color of the alert element.
 9   - titleLevel (string, optional): the level of the title element (h1, h2, h3, h4, h5, or h6).
 10   - title (string, optional): the title of the alert element.
 11   - iconTitle (string, optional): the name of the icon to include in the alert element.
 12   - dismissible (boolean, optional): whether the alert should be dismissible.
 13   - id (string, optional): the ID of the alert element. If not provided, a default ID will be generated.
 14   - params (string, optional): additional HTML attributes to include in the alert element.
 15   -->
 16   <#macro alert class='d-flex align-items-center' color='' titleLevel='h3' title='' iconTitle='' dismissible=false id='' params=''>
 17   <div class="alert rounded <#if color!=''>bg-body text-${color} border-${color}</#if><#if class!=''> ${class}</#if><#if dismissible> alert-dismissible</#if> shadow"<#if id!=''> id="${id}"</#if><#if params!=''> ${params}</#if>>
 18   <#if color!=''><#assign txtColor> text-${color}</#assign></#if>
 19   <#if iconTitle!=''><@icon style=iconTitle class='mx-2${txtColor}' /></#if>
 20   <#if title!=''><${titleLevel} class="alert-title ms-2">${title}</${titleLevel}></#if>
 21   <#nested>
 22   <#if dismissible><a class="btn-close mt-2" data-bs-dismiss="alert" aria-label="#i18n{portal.util.labelClose}"></a></#if>
 23   </div>
 24   </#macro>