Class: DsfrComponent::CalloutComponent
- Includes:
- Traits::HeaderSizeable
- Defined in:
- app/components/dsfr_component/callout_component.rb
Constant Summary
Constants included from Traits::HeaderSizeable
Traits::HeaderSizeable::DEFAULT_HEADER_LEVEL
Constants inherited from Base
Base::HEADING_LEVELS, Base::SIZES
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(title:, icon_name: "information-line", header_level: nil, html_attributes: {}) ⇒ CalloutComponent
constructor
A new instance of CalloutComponent.
Methods included from Traits::HeaderSizeable
#default_header_level, #header_level, #header_level=, #header_tag
Constructor Details
#initialize(title:, icon_name: "information-line", header_level: nil, html_attributes: {}) ⇒ CalloutComponent
Returns a new instance of CalloutComponent.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/components/dsfr_component/callout_component.rb', line 12 def initialize( title:, icon_name: "information-line", header_level: nil, html_attributes: {} ) @title = title @icon_name = icon_name self.header_level = header_level super(html_attributes: html_attributes) end |
Instance Method Details
#call ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'app/components/dsfr_component/callout_component.rb', line 25 def call tag.div(**html_attributes) do concat content_tag(header_tag, @title, class: 'fr-callout__title') concat content_tag(:p, content, class: 'fr-callout__text') concat action_zone if action_zone? end end |