{% set spacing = _args.spacing|default(false) %}
{% set sort = _args.sort|default(null) %}
{% set headerTitle = _args.headerTitle|default(null) %}
{% set title = _args.title %}
{% set style = '' %}
{% if spacing is same as(true) %}
{% set style = 'cell--auto' %}
{% elseif spacing matches '/^\\d+$/' %}
{% set style = 'w-%s'|format(
spacing
) %}
{% endif %}
<th class="table__sort {{ style }}
{% if sort.active|default(false) %}
table__sort--active
{% endif %}
">
<a
href="#"
{% if sort %}
title="Sort by {{ title }}"
data-sn-sort="{{ sort.key }}"
data-sn-sort-dir="{{ sort.dir }}"
{% endif %}
>
{% if headerTitle is not null %}
<small>{{ headerTitle }}</small>
<br />
{% endif %}
<span>{{ title }}</span>
{% if sort %}
<i class="icon-chevron-{{ sort.dir|dir_flip|lower }}"></i>
{% endif %}
</a>
</th>