progress.html 1.3 KB

1234567891011121314151617181920
  1. {% assign percentage = include.value | replace: '%', '' | default: 38 %}
  2. {% assign colors = include.colors | default: include.color | default: 'blue,red,green,yellow,dark' | split: ',' %}
  3. <div class="progress{% if include['size'] %} progress-{{ include['size'] }}{% endif %}{% if include.class %} {{ include.class }}{% endif %}"{% if include.width %} style="width: {{ include.width }}"{% endif %}>
  4. {% if include.indeterminate %}
  5. <div class="progress-bar progress-bar-indeterminate{% if include.color %} bg-{{ include.color }}{% endif %}"></div>
  6. {% elsif include.values %}
  7. {% assign values = include.values | split: ',' %}
  8. {% for value in values %}
  9. <div class="progress-bar bg-{{ colors[forloop.index0] }}" style="width: {{ value }}%" role="progressbar" aria-valuenow="{{ value }}" aria-valuemin="0" aria-valuemax="100"></div>
  10. {% endfor %}
  11. {% else %}
  12. <div class="progress-bar{% if include.color %} bg-{{ include.color }}{% endif %}" style="width: {{ percentage }}%" role="progressbar" aria-valuenow="{{ percentage }}" aria-valuemin="0" aria-valuemax="100" aria-label="{{ percentage }}% Complete">
  13. {% if include.show-value %}
  14. {{ percentage }}%
  15. {% else %}
  16. <span class="visually-hidden">{{ percentage }}% Complete</span>
  17. {% endif %}
  18. </div>
  19. {% endif %}
  20. </div>