sort.twig 975 B

1234567891011121314151617
  1. {# Sortable table header cell.
  2. Use together with `data-sortable-table="<id>"` on the wrapping <table>.
  3. `type` controls the comparator: `string` (case-insensitive locale),
  4. `number`, or `date` (ISO-8601). Cells in this column may set
  5. `data-sort-value="<raw>"` to override the displayed text. #}
  6. {% macro th(label, key, type='string', align='left', extra='', th_class='px-4 py-2 font-medium') %}
  7. <th class="{{ th_class }} {% if align == 'right' %}text-right{% endif %} {{ extra }}"
  8. data-sort-key="{{ key }}" data-sort-type="{{ type }}">
  9. <button type="button"
  10. class="sort-btn group inline-flex items-baseline gap-1 uppercase tracking-wider {% if align == 'right' %}flex-row-reverse{% endif %}"
  11. aria-label="Sort by {{ label }}">
  12. <span>{{ label }}</span>
  13. <span class="sort-indicator text-slate-300 dark:text-slate-600" aria-hidden="true">↕</span>
  14. </button>
  15. </th>
  16. {% endmacro %}