Class: CCS::Components::GovUK::StepByStepNavigation::Section::Heading
- Inherits:
-
Object
- Object
- CCS::Components::GovUK::StepByStepNavigation::Section::Heading
- Includes:
- ActionView::Context, ActionView::Helpers
- Defined in:
- lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb
Overview
GOV.UK Step by step navigation section heading
The heading for a navigation section
Instance Method Summary collapse
-
#initialize(text:, index:, logic: nil) ⇒ Heading
constructor
A new instance of Heading.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Step by step navigation section heading.
Constructor Details
#initialize(text:, index:, logic: nil) ⇒ Heading
Returns a new instance of Heading.
33 34 35 36 37 |
# File 'lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb', line 33 def initialize(text:, index:, logic: nil) @text = text @index = index @logic = logic end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Step by step navigation section heading
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb', line 45 def render tag.div(class: 'gem-c-step-nav__header js-toggle-panel', data: { position: index }) do tag.h2(class: 'gem-c-step-nav__title') do concat(tag.span(class: "gem-c-step-nav__circle gem-c-step-nav__circle--#{logic ? 'logic' : 'number'}") do tag.span(class: 'gem-c-step-nav__circle-inner') do tag.span(class: 'gem-c-step-nav__circle-background') do concat(tag.span('Step', class: 'govuk-visually-hidden')) concat(logic || index) end end end) concat(tag.span(class: 'js-step-title') do tag.span(text, class: 'js-step-title-text') end) end end end |