Sha256: f6c0a0fab2c99da9fb794ce02f4b74190efcddb28336a8497449531a4aac96b8

Contents?: true

Size: 1.54 KB

Versions: 20

Compression:

Stored size: 1.54 KB

Contents

require 'action_view'

module CCS
  module Components
    module GovUK
      class StepByStepNavigation < Base
        class Section < Base
          class Content
            class List
              # = GOV.UK Step by step navigation section content list item
              #
              # Generates the list item HTML for the step by step navigation section content
              #
              # @!attribute [r] text
              #   @return [String] Text for the list item
              # @!attribute [r] classes
              #   @return [String] HTML classes for the list item

              class Item
                include ActionView::Context
                include ActionView::Helpers

                private

                attr_reader :text, :classes

                public

                # @param text [String] the text for the list item
                # @param no_marker [Boolean] flag to hide the bullet marker

                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

                # Generates the HTML for an individual the GOV.UK Step by step navigation list item
                #
                # @return [ActiveSupport::SafeBuffer]

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ccs-frontend_helpers-2.1.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-2.0.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-1.2.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-1.1.2 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-1.1.1 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-1.1.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-1.1.0.beta0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-1.0.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-0.5.0.beta1 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-0.5.0.beta0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-0.3.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-0.2.0 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-0.1.2 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-0.1.1 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-0.1.1.rc.1 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-0.1.0.rc.7 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-0.1.0.rc.6 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-0.1.0.rc.5 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-0.1.0.rc.4 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb
ccs-frontend_helpers-0.1.0.rc.3 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb