Class: GovukComponent::WarningTextComponent
- Defined in:
- app/components/govuk_component/warning_text_component.rb
Instance Attribute Summary collapse
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#icon_fallback_text ⇒ Object
readonly
Returns the value of attribute icon_fallback_text.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(text: nil, icon_fallback_text: config.default_warning_text_icon_fallback_text, icon: config.default_warning_text_icon, classes: [], html_attributes: {}) ⇒ WarningTextComponent
constructor
A new instance of WarningTextComponent.
Methods inherited from Base
Constructor Details
#initialize(text: nil, icon_fallback_text: config.default_warning_text_icon_fallback_text, icon: config.default_warning_text_icon, classes: [], html_attributes: {}) ⇒ WarningTextComponent
Returns a new instance of WarningTextComponent.
4 5 6 7 8 9 10 |
# File 'app/components/govuk_component/warning_text_component.rb', line 4 def initialize(text: nil, icon_fallback_text: config.default_warning_text_icon_fallback_text, icon: config.default_warning_text_icon, classes: [], html_attributes: {}) @text = text @icon = icon @icon_fallback_text = icon_fallback_text super(classes:, html_attributes:) end |
Instance Attribute Details
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
2 3 4 |
# File 'app/components/govuk_component/warning_text_component.rb', line 2 def icon @icon end |
#icon_fallback_text ⇒ Object (readonly)
Returns the value of attribute icon_fallback_text.
2 3 4 |
# File 'app/components/govuk_component/warning_text_component.rb', line 2 def icon_fallback_text @icon_fallback_text end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
2 3 4 |
# File 'app/components/govuk_component/warning_text_component.rb', line 2 def text @text end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 |
# File 'app/components/govuk_component/warning_text_component.rb', line 12 def call tag.div(**html_attributes) do safe_join([icon_element, warning_text]) end end |