class Playbook::PbTable::TableHeader

def active_item

def active_item
  active_item = {}
  sort_menu.each do |item|
    active_item = item if item[:active] == true
  end
  active_item
end

def align_class

def align_class
  align.present? ? "align_#{align}" : nil
end

def classname

def classname
  generate_classname("pb_table_header_kit", align_class)
end

def link_style

def link_style
  active_item.any? ? "" : "color: #687887;"
end

def next_link

def next_link
  return sort_menu[0][:link] if sort_menu.all? { |item| item[:active] == false }
  link = ""
  sort_menu.each_with_index do |item, index|
    if item[:active] == true
      next_index = (index + 1) % sort_menu.length
      link = sort_menu[next_index][:link]
    end
  end
  link
end

def sort_icon(direction, active)

def sort_icon(direction, active)
  case direction
  when "asc"
    active ? "sort-amount-up" : ""
  when "desc"
    active ? "sort-amount-down" : ""
  else
    "arrow-up-arrow-down"
  end
end

def sorting_style?

def sorting_style?
  sort_menu != [{}]
end

def use_dropdown_select

def use_dropdown_select
  sort_menu != [{}] && (object.colspan > 1 || sort_dropdown)
end