Sha256: 4e5afd802e570e312181f1041de1c721dda92c8fcaf04a6bf8caa6d42fdd5f91

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

require 'action_view'

module CCS::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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ccs-frontend_helpers-0.1.0.rc.2 lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb