Class: Daisy::Layout::HoverGalleryComponent::ImageComponent

Inherits:
LocoMotion::BasicComponent show all
Defined in:
app/components/daisy/layout/hover_gallery_component.rb

Overview

Renders a single image inside the hover gallery.

Instance Method Summary collapse

Methods inherited from LocoMotion::BasicComponent

#call, name

Constructor Details

#initialize(src: nil, alt: nil, **kws) ⇒ ImageComponent

Returns a new instance of ImageComponent.



50
51
52
53
54
# File 'app/components/daisy/layout/hover_gallery_component.rb', line 50

def initialize(src: nil, alt: nil, **kws)
  super(**kws)
  @src = src
  @alt = alt
end

Instance Method Details

#before_renderObject



56
57
58
59
60
# File 'app/components/daisy/layout/hover_gallery_component.rb', line 56

def before_render
  set_tag_name(:component, :img)
  add_html(:component, { src: @src, alt: @alt }.compact)
  super
end