Class: DsfrComponent::HeaderComponent::OperatorImageComponent

Inherits:
Base
  • Object
show all
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

#html_attributes

Instance Method Summary collapse

Constructor Details

#initialize(title:, src:, alt:, html_attributes: {}) ⇒ OperatorImageComponent



5
6
7
8
9
10
11
# File 'app/components/dsfr_component/header_component/operator_image_component.rb', line 5

def initialize(title:, src:, alt:, html_attributes: {})
  @title = title
  @src = src
  @alt = alt

  super(html_attributes: html_attributes)
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
# File 'app/components/dsfr_component/header_component/operator_image_component.rb', line 13

def call
  tag.div(class: "fr-header__operator") do
    tag.a(href: "/", title: title) do
      tag.img(class: "fr-responsive-img", src: src, alt: alt, style: "max-width:9.0625rem;")
    end
  end
end

#default_attributesObject



21
22
23
# File 'app/components/dsfr_component/header_component/operator_image_component.rb', line 21

def default_attributes
  {}
end