Class: GovukComponent::PanelComponent
- Defined in:
- app/components/govuk_component/panel_component.rb
Instance Attribute Summary collapse
-
#heading_level ⇒ Object
readonly
Returns the value of attribute heading_level.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#title_text ⇒ Object
readonly
Returns the value of attribute title_text.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(title_text: nil, text: nil, heading_level: 1, id: nil, classes: [], html_attributes: {}) ⇒ PanelComponent
constructor
A new instance of PanelComponent.
Methods inherited from Base
Constructor Details
#initialize(title_text: nil, text: nil, heading_level: 1, id: nil, classes: [], html_attributes: {}) ⇒ PanelComponent
Returns a new instance of PanelComponent.
6 7 8 9 10 11 12 13 |
# File 'app/components/govuk_component/panel_component.rb', line 6 def initialize(title_text: nil, text: nil, heading_level: 1, id: nil, classes: [], html_attributes: {}) @heading_level = heading_level @title_text = title_text @text = text @id = id super(classes:, html_attributes:) end |
Instance Attribute Details
#heading_level ⇒ Object (readonly)
Returns the value of attribute heading_level.
2 3 4 |
# File 'app/components/govuk_component/panel_component.rb', line 2 def heading_level @heading_level end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
2 3 4 |
# File 'app/components/govuk_component/panel_component.rb', line 2 def id @id end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
2 3 4 |
# File 'app/components/govuk_component/panel_component.rb', line 2 def text @text end |
#title_text ⇒ Object (readonly)
Returns the value of attribute title_text.
2 3 4 |
# File 'app/components/govuk_component/panel_component.rb', line 2 def title_text @title_text end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 |
# File 'app/components/govuk_component/panel_component.rb', line 15 def call tag.div(id:, **html_attributes) do safe_join([panel_title, panel_body].compact) end end |