Class: GovukComponent::CookieBannerComponent
- Defined in:
- app/components/govuk_component/cookie_banner_component.rb
Defined Under Namespace
Classes: MessageComponent
Instance Attribute Summary collapse
-
#aria_label ⇒ Object
Returns the value of attribute aria_label.
-
#hidden ⇒ Object
Returns the value of attribute hidden.
Attributes inherited from Base
Attributes included from Traits::CustomHtmlAttributes
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(aria_label: "Cookie banner", hidden: false, classes: [], html_attributes: {}) ⇒ CookieBannerComponent
constructor
A new instance of CookieBannerComponent.
Methods included from Traits::CustomClasses
Methods included from Govuk::Components::Helpers::CssUtilities
Constructor Details
#initialize(aria_label: "Cookie banner", hidden: false, classes: [], html_attributes: {}) ⇒ CookieBannerComponent
Returns a new instance of CookieBannerComponent.
6 7 8 9 10 11 |
# File 'app/components/govuk_component/cookie_banner_component.rb', line 6 def initialize(aria_label: "Cookie banner", hidden: false, classes: [], html_attributes: {}) super(classes: classes, html_attributes: html_attributes) @aria_label = aria_label @hidden = hidden end |
Instance Attribute Details
#aria_label ⇒ Object
Returns the value of attribute aria_label.
4 5 6 |
# File 'app/components/govuk_component/cookie_banner_component.rb', line 4 def aria_label @aria_label end |
#hidden ⇒ Object
Returns the value of attribute hidden.
4 5 6 |
# File 'app/components/govuk_component/cookie_banner_component.rb', line 4 def hidden @hidden end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 |
# File 'app/components/govuk_component/cookie_banner_component.rb', line 13 def call tag.div(class: classes, role: "region", aria: { label: aria_label }, hidden: hidden, **html_attributes) do safe_join() end end |