Class: Daisy::Layout::HoverGalleryComponent
- Inherits:
-
LocoMotion::BaseComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- Daisy::Layout::HoverGalleryComponent
- Defined in:
- app/components/daisy/layout/hover_gallery_component.rb
Overview
By default the gallery is rendered with a 3:2 aspect ratio
(where:aspect-[3/2]) so that images with differing aspect ratios don't
shift the container's height as they are revealed on hover. The default
uses DaisyUI's zero-specificity where: variant and is skipped entirely
when you pass your own aspect-* utility (e.g. aspect-square) via
css:, so it is easy to override.
The HoverGalleryComponent displays a container of images where the first image is visible by default and hovering horizontally reveals the others. Common use cases include product cards on e-commerce sites, portfolios, and image galleries. DaisyUI supports up to 10 images.
The underlying HTML is a <figure> containing <img> elements. DaisyUI
creates invisible columns over the figure; hovering each column reveals the
corresponding image.
Defined Under Namespace
Classes: ImageComponent
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(srcs: nil, **kws) ⇒ HoverGalleryComponent
constructor
Creates a new HoverGalleryComponent.
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(srcs: nil, **kws) ⇒ HoverGalleryComponent
Creates a new HoverGalleryComponent.
80 81 82 83 84 |
# File 'app/components/daisy/layout/hover_gallery_component.rb', line 80 def initialize(srcs: nil, **kws) super(**kws) @srcs = srcs @css = config_option(:css, "") end |
Instance Method Details
#before_render ⇒ Object
86 87 88 89 |
# File 'app/components/daisy/layout/hover_gallery_component.rb', line 86 def before_render setup_component super end |