<%= content_tag :th, **@rest do %>
  <%= content_tag :div, class: 'flex gap-2 items-center' do %>
    <% if @id %>
      <% if sort_arrow %>
        <%= link_to href, class: 'cursor-pointer whitespace-nowrap flex gap-1 items-center items-end relative' do %>
          <div class="text-teal-400 font-light absolute -left-4">
            <%= sort_arrow %>
          </div>
          <%= @title %>
        <% end %>
      <% else %>
        <%= link_to @title, href, class: 'cursor-pointer'  %>
      <% end %>
    <% else %>
      <%= @title %>
    <% end %>

    <% if tooltip %>
      <%= tooltip %>
    <% end %>
  <% end %>
<% end %>

<%= content_tag :th, **@rest do %>
  <%= content_tag :div, class: (@rest[:align] == 'left' ? 'justify-start' : 'justify-end') + ' flex gap-2 items-center' do %>
    <% if @id %>
      <% if sort_arrow %>
        <%= link_to href, class: 'cursor-pointer whitespace-nowrap flex gap-1 items-center items-end relative' do %>
          <div class="text-teal-400 font-light absolute -left-4">
            <%= sort_arrow %>
          </div>
          <%= @title %>
        <% end %>
      <% else %>
        <%= link_to @title, href, class: 'cursor-pointer'  %>
      <% end %>
    <% else %>
      <%= @title %>
    <% end %>

    <% if tooltip %>
      <%= tooltip %>
    <% end %>
  <% end %>
<% end %>

Add conditional for flex alignment based on table heading alignment
Add conditional for flex alignment based on table heading alignment

Closes: #1141
