Class: DaisyUI::Card::Figure
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- DaisyUI::Card::Figure
- Defined in:
- app/components/daisy_ui/data_display/card/figure.rb
Overview
Figure component for the card, handling image display
Instance Method Summary collapse
- #before_render ⇒ Object
- #call ⇒ Object
-
#initialize(img_url: nil, img_alt: nil, **system_arguments) ⇒ Figure
constructor
A new instance of Figure.
Constructor Details
#initialize(img_url: nil, img_alt: nil, **system_arguments) ⇒ Figure
27 28 29 30 31 |
# File 'app/components/daisy_ui/data_display/card/figure.rb', line 27 def initialize(img_url: nil, img_alt: nil, **system_arguments) @img_url = img_url @img_alt = img_alt super(**system_arguments) end |
Instance Method Details
#before_render ⇒ Object
33 34 35 |
# File 'app/components/daisy_ui/data_display/card/figure.rb', line 33 def before_render with_image { tag.img(src: @img_url, alt: @img_alt) } if @img_url && !image? end |
#call ⇒ Object
37 38 39 40 41 |
# File 'app/components/daisy_ui/data_display/card/figure.rb', line 37 def call tag.figure(**system_arguments) do safe_join([image, content].compact) end end |