Sha256: a76f684b47468070b29d696bfc59094b3991420dfa5f1945fe12047374f8dcfd

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

# frozen_string_literal: true

module Katalyst
  module Tables
    class HeaderRowComponent < ViewComponent::Base # :nodoc:
      include Frontend::Helper

      renders_many :columns, ->(component) { component }

      def initialize(table)
        super()

        @table = table
      end

      def call
        content # generate content before rendering

        tag.tr(**@html_options) do
          columns.each do |column|
            concat(column.to_s)
          end
        end
      end

      def cell(attribute, **options, &block)
        with_column(@table.class.header_cell_component.new(@table, attribute, **options), &block)
      end

      def header?
        true
      end

      def body?
        false
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
katalyst-tables-2.0.0 app/components/katalyst/tables/header_row_component.rb