2
0

alert.html 1.8 KB

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