Class: CCS::Components::GovUK::StepByStepNavigation::Section::Content::List

Inherits:
Object
  • Object
show all
Includes:
ActionView::Context, ActionView::Helpers
Defined in:
lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb,
lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb

Overview

GOV.UK Step by step navigation section content list

Generates the list HTML for the step by step navigation section content

Defined Under Namespace

Classes: Item

Instance Method Summary collapse

Constructor Details

#initialize(items:) ⇒ List

Returns a new instance of List.

Parameters:

  • items (Array<Hash>)

    An array of options for the list items See Item#initialize for details of the items in the array.



31
32
33
# File 'lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb', line 31

def initialize(items:)
  @items = items.map { |item| Item.new(**item) }
end

Instance Method Details

#renderActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK Step by step navigation section content list

Returns:

  • (ActiveSupport::SafeBuffer)


39
40
41
42
43
# File 'lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb', line 39

def render
  tag.ul(class: 'gem-c-step-nav__list gem-c-step-nav__list--choice', data: { length: items.length.to_s }) do
    items.each { |item| concat(item.render) }
  end
end