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

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

Overview

GOV.UK Step by step navigation section content list item

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

Instance Method Summary collapse

Constructor Details

#initialize(text:, no_marker: nil) ⇒ Item

Returns a new instance of Item.

Parameters:

  • text (String)

    the text for the list item

  • no_marker (Boolean) (defaults to: nil)

    flag to hide the bullet marker



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

def initialize(text:, no_marker: nil)
  @text = text
  @classes = "gem-c-step-nav__list-item js-list-item #{'gem-c-step-nav__list--no-marker' if no_marker}".rstrip
end

Instance Method Details

#renderActiveSupport::SafeBuffer

Generates the HTML for an individual the GOV.UK Step by step navigation list item

Returns:

  • (ActiveSupport::SafeBuffer)


41
42
43
44
45
# File 'lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb', line 41

def render
  tag.li(class: classes) do
    tag.span(text)
  end
end