Sha256: 9ad1b55c6c3828ea0d9f70f73219474530167d7ffd4b90d8e41a8161c9b8eece

Contents?: true

Size: 756 Bytes

Versions: 11

Compression:

Stored size: 756 Bytes

Contents

# frozen_string_literal: true

using Katalyst::HtmlAttributes::HasHtmlAttributes

module Koi
  module Tables
    class HeaderCellComponent < Katalyst::Tables::HeaderCellComponent
      attr_reader :width

      def initialize(table, attribute, label: nil, link: {}, width: nil, **html_attributes)
        @width = width

        super(table, attribute, label:, link:, **html_attributes)
      end

      def default_html_attributes
        super.merge_html(class: width_class)
      end

      private

      def width_class
        case width
        when :xs
          "width-xs"
        when :s
          "width-s"
        when :m
          "width-m"
        when :l
          "width-l"
        else
          ""
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
katalyst-koi-4.6.0 app/components/koi/tables/header_cell_component.rb
katalyst-koi-4.5.9 app/components/koi/tables/header_cell_component.rb
katalyst-koi-4.5.8 app/components/koi/tables/header_cell_component.rb
katalyst-koi-4.5.7 app/components/koi/tables/header_cell_component.rb
katalyst-koi-4.5.6 app/components/koi/tables/header_cell_component.rb
katalyst-koi-4.5.5 app/components/koi/tables/header_cell_component.rb
katalyst-koi-4.5.4 app/components/koi/tables/header_cell_component.rb
katalyst-koi-4.5.3 app/components/koi/tables/header_cell_component.rb
katalyst-koi-4.5.2 app/components/koi/tables/header_cell_component.rb
katalyst-koi-4.5.1 app/components/koi/tables/header_cell_component.rb
katalyst-koi-4.5.0 app/components/koi/tables/header_cell_component.rb