Class: GovukComponent::StartButtonComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/govuk_component/start_button_component.rb

Constant Summary collapse

BUTTON_ATTRIBUTES =
{
  role: 'button',
  draggable: 'false',
  data: { module: 'govuk-button' }
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Base

#html_attributes

Instance Method Summary collapse

Constructor Details

#initialize(text:, href:, classes: [], html_attributes: {}) ⇒ StartButtonComponent

Returns a new instance of StartButtonComponent.



10
11
12
13
14
15
# File 'app/components/govuk_component/start_button_component.rb', line 10

def initialize(text:, href:, classes: [], html_attributes: {})
  @text = text
  @href = href

  super(classes: classes, html_attributes: html_attributes)
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



8
9
10
# File 'app/components/govuk_component/start_button_component.rb', line 8

def href
  @href
end

#textObject (readonly)

Returns the value of attribute text.



8
9
10
# File 'app/components/govuk_component/start_button_component.rb', line 8

def text
  @text
end

Instance Method Details

#callObject



17
18
19
20
21
# File 'app/components/govuk_component/start_button_component.rb', line 17

def call
  link_to(href, **html_attributes) do
    safe_join([text, icon])
  end
end