Class: CCS::Components::GovUK::SkipLink
- Defined in:
- lib/ccs/components/govuk/skip_link.rb
Overview
GOV.UK Skip Link
This is used to generate the skip link component from the GDS - Components - Skip link
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
The default attributes for the skip link
{ class: 'govuk-skip-link', data: { module: 'govuk-skip-link' } }.freeze
Instance Method Summary collapse
-
#initialize(text:, href: nil, **options) ⇒ SkipLink
constructor
A new instance of SkipLink.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Skip link component.
Constructor Details
#initialize(text:, href: nil, **options) ⇒ SkipLink
Returns a new instance of SkipLink.
30 31 32 33 34 35 |
# File 'lib/ccs/components/govuk/skip_link.rb', line 30 def initialize(text:, href: nil, **) super(**) @text = text @href = href || '#content' end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Skip link component
41 42 43 |
# File 'lib/ccs/components/govuk/skip_link.rb', line 41 def render link_to(text, href, **[:attributes]) end |