Class: Daisy::Layout::HoverGalleryComponent::ImageComponent
- Inherits:
-
LocoMotion::BasicComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- LocoMotion::BasicComponent
- Daisy::Layout::HoverGalleryComponent::ImageComponent
- Defined in:
- app/components/daisy/layout/hover_gallery_component.rb
Overview
Renders a single image inside the hover gallery.
Constant Summary
Constants inherited from LocoMotion::BaseComponent
LocoMotion::BaseComponent::EMPTY_PART_IGNORED_TAGS, LocoMotion::BaseComponent::SELF_CLOSING_TAGS
Instance Attribute Summary
Attributes inherited from LocoMotion::BaseComponent
Instance Method Summary collapse
- #before_render ⇒ Object
-
#initialize(src: nil, alt: nil, **kws) ⇒ ImageComponent
constructor
A new instance of ImageComponent.
Methods inherited from LocoMotion::BasicComponent
Methods inherited from LocoMotion::BaseComponent
build, #component_ref, #config_option, #cssify, define_modifier, define_modifiers, define_part, define_parts, define_size, define_sizes, #empty_part_content, #inspect, #part, register_component_initializer, register_component_setup, #rendered_css, #rendered_data, #rendered_html, #rendered_stimulus_controllers, #rendered_tag_name, renders_many, renders_one, set_component_name, #set_loco_parent, #strip_spaces
Methods included from LocoMotion::Concerns::InspectableComponent
Constructor Details
#initialize(src: nil, alt: nil, **kws) ⇒ ImageComponent
Returns a new instance of ImageComponent.
42 43 44 45 46 |
# File 'app/components/daisy/layout/hover_gallery_component.rb', line 42 def initialize(src: nil, alt: nil, **kws) super(**kws) @src = src @alt = alt end |
Instance Method Details
#before_render ⇒ Object
48 49 50 51 52 |
# File 'app/components/daisy/layout/hover_gallery_component.rb', line 48 def before_render set_tag_name(:component, :img) add_html(:component, { src: @src, alt: @alt }.compact) super end |