alert.html 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. {% assign icon = include.icon %}
  2. {% unless icon %}
  3. {% if include.type == 'success' %}
  4. {% assign icon = 'check' %}
  5. {% elsif include.type == 'warning' %}
  6. {% assign icon = 'alert-triangle' %}
  7. {% elsif include.type == 'danger' %}
  8. {% assign icon = 'alert-circle' %}
  9. {% elsif include.type == 'info' %}
  10. {% assign icon = 'info-circle' %}
  11. {% endif %}
  12. {% endunless %}
  13. <div class="alert{% if include.important %} alert-important{% endif %} alert-{{ include.type | default: 'primary'}}{%if include.show-close %} alert-dismissible{% endif %}{% if include.avatar %} alert-avatar{% endif %}" role="alert">
  14. <div class="alert-icon">
  15. {% include "ui/icon.html" icon=icon class="alert-icon" %}
  16. </div>
  17. {% if include.description or include.list %}
  18. <div>
  19. <h4 class="alert-heading">{{ include.title | default: "This is a custom alert box!" }}</h4>
  20. <div class="alert-description">
  21. {{ include.description | default: description }}
  22. {% if include.list %}
  23. {% assign items = include.list | split: ',' %}
  24. <ul class="alert-list">
  25. {% for item in items %}
  26. <li>{{ item }}</li>
  27. {% endfor %}
  28. </ul>
  29. {% endif %}
  30. </div>
  31. </div>
  32. {% else %}
  33. {{ include.title | default: "This is a custom alert box!" }}
  34. {% if include.action %}
  35. <a href="#" class="alert-action">
  36. Link
  37. </a>
  38. {% endif %}
  39. {% endif %}
  40. {% if include.buttons %}
  41. <div class="btn-list">
  42. <a href="#" class="btn btn-{{ include.type | default: 'primary'}}">Okay</a>
  43. <a href="#" class="btn">Cancel</a>
  44. </div>
  45. {% endif %}
  46. {% if include.show-close %}<a class="btn-close" data-bs-dismiss="alert" aria-label="close"></a>{% endif %}
  47. </div>