Class: DsfrComponent::HeaderComponent::OperatorImageComponent
- Inherits:
-
Base
- Object
- ViewComponent::Base
- Base
- DsfrComponent::HeaderComponent::OperatorImageComponent
- Defined in:
- app/components/dsfr_component/header_component/operator_image_component.rb
Constant Summary
Constants inherited from Base
Base::HEADING_LEVELS, Base::SIZES
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
- #default_attributes ⇒ Object
-
#initialize(src:, alt:, href: "/", title: nil, html_attributes: {}) ⇒ OperatorImageComponent
constructor
A new instance of OperatorImageComponent.
Constructor Details
#initialize(src:, alt:, href: "/", title: nil, html_attributes: {}) ⇒ OperatorImageComponent
Returns a new instance of OperatorImageComponent.
6 7 8 9 10 11 12 13 |
# File 'app/components/dsfr_component/header_component/operator_image_component.rb', line 6 def initialize(src:, alt:, href: "/", title: nil, html_attributes: {}) @src = src @alt = alt @href = href @title = title super(html_attributes: html_attributes) end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/components/dsfr_component/header_component/operator_image_component.rb', line 15 def call tag.div(class: "fr-header__operator") do if href tag.a(href: href, title: title) do image_tag end else image_tag end end end |
#default_attributes ⇒ Object
27 28 29 |
# File 'app/components/dsfr_component/header_component/operator_image_component.rb', line 27 def default_attributes {} end |