Class: CCS::Components::GovUK::Header
- Defined in:
- lib/ccs/components/govuk/header.rb
Overview
GOV.UK Header
This is used to generate the header component from the GDS - Components - Header
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
The default attributes for the breadcrumbs
{ class: 'govuk-header' }.freeze
Instance Method Summary collapse
-
#initialize ⇒ Header
constructor
A new instance of Header.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Header component.
Constructor Details
#initialize ⇒ Header
Returns a new instance of Header.
42 43 44 45 46 47 48 49 |
# File 'lib/ccs/components/govuk/header.rb', line 42 def initialize(**) super @options[:container_classes] ||= 'govuk-width-container' @options[:homepage_url] ||= '//gov.uk' @logo = Logo.new(classes: 'govuk-header__logotype', attributes: { aria: { label: 'GOV.UK' } }, context: @context) end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Header component
55 56 57 58 59 60 61 |
# File 'lib/ccs/components/govuk/header.rb', line 55 def render tag.div(**[:attributes]) do tag.div(class: "govuk-header__container #{[:container_classes]}") do concat(header_logo) end end end |