Class: UI::AvatarComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::AvatarComponent
- Includes:
- AvatarBehavior
- Defined in:
- app/view_components/ui/avatar_component.rb
Overview
Avatar - ViewComponent implementation
Displays an image element with a fallback for representing users.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(classes: "", **attributes) ⇒ AvatarComponent
constructor
A new instance of AvatarComponent.
Methods included from AvatarBehavior
#avatar_classes, #avatar_data_attributes, #avatar_html_attributes
Constructor Details
#initialize(classes: "", **attributes) ⇒ AvatarComponent
Returns a new instance of AvatarComponent.
11 12 13 14 |
# File 'app/view_components/ui/avatar_component.rb', line 11 def initialize(classes: "", **attributes) @classes = classes @attributes = attributes end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 |
# File 'app/view_components/ui/avatar_component.rb', line 16 def call tag.span(**avatar_html_attributes.deep_merge(@attributes)) do content end end |