avatar.html 1.6 KB

123456789101112131415161718192021222324
  1. {% assign src = include.src %}
  2. {% assign placeholder = include.placeholder %}
  3. {% if include.person-id %}
  4. {% assign person-id = include.person-id | minus: 1 %}
  5. {% assign person = people[person-id] %}
  6. {% assign src = person.photo %}
  7. {% unless src %}
  8. {% assign placeholder = person.full_name | first_letters %}
  9. {% endunless %}
  10. {% elsif include.person %}
  11. {% assign person = include.person %}
  12. {% assign src = person.photo %}
  13. {% unless src %}
  14. {% assign placeholder = person.full_name | first_letters %}
  15. {% endunless %}
  16. {% endif %}
  17. {% assign link = include.link | default: false %}
  18. {% if include.dropdown %}
  19. {% assign link = true %}
  20. {% endif %}
  21. {% assign el = 'span' %}
  22. {% if link %}{% assign el = 'a' %}{% endif %}
  23. <{{ el }} class="avatar{% if include['size'] %} avatar-{{ include['size'] }}{% endif %}{% if include.thumb %} avatar-thumb{% endif %}{% if include.class %} {{ include.class }}{% endif %}{% if include.shape %} {{ include.shape }}{% endif %}{% if include.color %} bg-{{ include.color }}-lt{% endif %}{% if include.rounded %} rounded{% endif %}"{% if src %} style="background-image: url({{ site.base }}/{{ src }})"{% endif %}{% if include.dropdown %} data-bs-toggle="dropdown"{% endif %}>{% if include.status %}
  24. <span class="badge bg-{{ include.status }}">{% if include.status-text %}{{ include.status-text }}{% elsif include.status-icon %}{% include "ui/icon.html" icon=include.status-icon class="avatar-status-icon" %}{% endif %}</span>{% endif %}{% if placeholder %}{{ placeholder }}{% elsif include.icon %}{% include "ui/icon.html" icon=include.icon class="avatar-icon" %}{% endif %}</{{ el }}>