Class: UI::AvatarImageComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::AvatarImageComponent
- Includes:
- AvatarImageBehavior
- Defined in:
- app/view_components/ui/avatar_image_component.rb
Overview
Avatar Image - ViewComponent implementation
Displays the avatar image. Only renders when it has loaded successfully.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(src:, alt: "", classes: "", **attributes) ⇒ AvatarImageComponent
constructor
A new instance of AvatarImageComponent.
Methods included from AvatarImageBehavior
#avatar_image_classes, #avatar_image_data_attributes, #avatar_image_html_attributes
Constructor Details
#initialize(src:, alt: "", classes: "", **attributes) ⇒ AvatarImageComponent
Returns a new instance of AvatarImageComponent.
13 14 15 16 17 18 |
# File 'app/view_components/ui/avatar_image_component.rb', line 13 def initialize(src:, alt: "", classes: "", **attributes) @src = src @alt = alt @classes = classes @attributes = attributes end |
Instance Method Details
#call ⇒ Object
20 21 22 |
# File 'app/view_components/ui/avatar_image_component.rb', line 20 def call tag.img(**avatar_image_html_attributes.deep_merge(@attributes)) end |