Class: GovukComponent::FeedbackComponent

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title_text: nil, text: nil, heading_level: 2, classes: [], html_attributes: {}) ⇒ FeedbackComponent

Returns a new instance of FeedbackComponent.



7
8
9
10
11
12
13
# File 'app/components/govuk_component/feedback_component.rb', line 7

def initialize(title_text: nil, text: nil, heading_level: 2, classes: [], html_attributes: {})
  @title_text = title_text
  @text = text
  @heading_level = %(h#{heading_level})

  super(classes:, html_attributes:)
end

Instance Attribute Details

#heading_levelObject (readonly)

Returns the value of attribute heading_level.



2
3
4
# File 'app/components/govuk_component/feedback_component.rb', line 2

def heading_level
  @heading_level
end

#textObject (readonly)

Returns the value of attribute text.



2
3
4
# File 'app/components/govuk_component/feedback_component.rb', line 2

def text
  @text
end

#title_textObject (readonly)

Returns the value of attribute title_text.



2
3
4
# File 'app/components/govuk_component/feedback_component.rb', line 2

def title_text
  @title_text
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
22
23
# File 'app/components/govuk_component/feedback_component.rb', line 15

def call
  tag.div(**html_attributes) do
    tag.div(class: "#{brand}-grid-row") do
      tag.div(class: "#{brand}-grid-column-two-thirds") do
        safe_join([title_content, text_content])
      end
    end
  end
end