Sha256: 2b247b20884a5be4874dc50c1af0ca4404d57f3bedaaf2d300b51cbeae747887

Contents?: true

Size: 1013 Bytes

Versions: 16

Compression:

Stored size: 1013 Bytes

Contents

# frozen_string_literal: true

require_relative '../../components/govuk/table'

module CCS
  module FrontendHelpers
    module GovUKFrontend
      # = GOV.UK Table
      #
      # This helper is used for generating the table component from the
      # {https://design-system.service.gov.uk/components/table GDS - Components - Table}

      module Table
        # Generates the HTML for the GOV.UK Table component
        #
        # @param (see CCS::Components::GovUK::Table#initialize)
        #
        # @option (see CCS::Components::GovUK::Table#initialize)
        #
        # @return (see CCS::Components::GovUK::Table#render)

        def govuk_table(head_cells_or_rows, rows = nil, **options)
          if rows.nil?
            rows = head_cells_or_rows
            head_cells = nil
          else
            head_cells = head_cells_or_rows
          end

          Components::GovUK::Table.new(context: self, rows: rows, head_cells: head_cells, **options).render
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ccs-frontend_helpers-2.1.0 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-2.0.0 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-1.2.0 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-1.1.2 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-1.1.1 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-1.1.0 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-1.1.0.beta0 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-1.0.0 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-0.5.0.beta1 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-0.5.0.beta0 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-0.3.0 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-0.2.0 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-0.1.2 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-0.1.1 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-0.1.1.rc.1 lib/ccs/frontend_helpers/govuk_frontend/table.rb
ccs-frontend_helpers-0.1.0.rc.7 lib/ccs/frontend_helpers/govuk_frontend/table.rb