Class: CCS::Components::GovUK::Footer::Navigation
- Inherits:
-
Object
- Object
- CCS::Components::GovUK::Footer::Navigation
- Includes:
- ActionView::Context, ActionView::Helpers
- Defined in:
- lib/ccs/components/govuk/footer/navigation.rb
Overview
GOV.UK Footer Navigation
The individual footer navigation item
Instance Method Summary collapse
-
#initialize(title:, items:, context:, width: nil, columns: nil) ⇒ Navigation
constructor
A new instance of Navigation.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Footer Navigation sections.
Constructor Details
#initialize(title:, items:, context:, width: nil, columns: nil) ⇒ Navigation
Returns a new instance of Navigation.
37 38 39 40 41 42 |
# File 'lib/ccs/components/govuk/footer/navigation.rb', line 37 def initialize(title:, items:, context:, width: nil, columns: nil) @title = title @navigation_links = items.map { || Link.new(li_class: 'govuk-footer__list-item', context: context, **) } @width = width || 'full' @columns = columns end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Footer Navigation sections
48 49 50 51 52 53 54 55 |
# File 'lib/ccs/components/govuk/footer/navigation.rb', line 48 def render tag.div(class: "govuk-footer__section govuk-grid-column-#{width}") do concat(tag.h2(title, class: 'govuk-footer__heading govuk-heading-m')) concat(tag.ul(class: "govuk-footer__list #{"govuk-footer__list--columns-#{columns}" if columns}".rstrip) do .each { || concat(.render) } end) end end |