Class: GovukComponent::CookieBannerComponent::MessageComponent
- Inherits:
-
Base
- Object
- ViewComponent::Base
- Base
- GovukComponent::CookieBannerComponent::MessageComponent
- Defined in:
- app/components/govuk_component/cookie_banner_component/message_component.rb
Instance Attribute Summary collapse
-
#heading_text ⇒ Object
readonly
Returns the value of attribute heading_text.
-
#hidden ⇒ Object
readonly
Returns the value of attribute hidden.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(heading_text: nil, text: nil, hidden: false, role: nil, classes: [], html_attributes: {}) ⇒ MessageComponent
constructor
A new instance of MessageComponent.
Methods inherited from Base
Constructor Details
#initialize(heading_text: nil, text: nil, hidden: false, role: nil, classes: [], html_attributes: {}) ⇒ MessageComponent
Returns a new instance of MessageComponent.
7 8 9 10 11 12 13 14 |
# File 'app/components/govuk_component/cookie_banner_component/message_component.rb', line 7 def initialize(heading_text: nil, text: nil, hidden: false, role: nil, classes: [], html_attributes: {}) @heading_text = heading_text @text = text @hidden = hidden @role = role super(classes:, html_attributes:) end |
Instance Attribute Details
#heading_text ⇒ Object (readonly)
Returns the value of attribute heading_text.
2 3 4 |
# File 'app/components/govuk_component/cookie_banner_component/message_component.rb', line 2 def heading_text @heading_text end |
#hidden ⇒ Object (readonly)
Returns the value of attribute hidden.
2 3 4 |
# File 'app/components/govuk_component/cookie_banner_component/message_component.rb', line 2 def hidden @hidden end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
2 3 4 |
# File 'app/components/govuk_component/cookie_banner_component/message_component.rb', line 2 def role @role end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
2 3 4 |
# File 'app/components/govuk_component/cookie_banner_component/message_component.rb', line 2 def text @text end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'app/components/govuk_component/cookie_banner_component/message_component.rb', line 16 def call tag.div(role:, hidden:, **html_attributes) do safe_join([ tag.div(class: "#{brand}-grid-row") do tag.div(class: "#{brand}-grid-column-two-thirds") { safe_join([heading_element, ]) } end, actions_element ]) end end |