Class: UI::AvatarImage
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::AvatarImage
- Includes:
- AvatarImageBehavior
- Defined in:
- app/components/ui/avatar_image.rb
Overview
Avatar Image - Phlex implementation
Displays the avatar image. Only renders when it has loaded successfully. Uses AvatarImageBehavior module for shared styling logic.
Based on shadcn/ui Avatar: ui.shadcn.com/docs/components/avatar Based on Radix UI Avatar: www.radix-ui.com/primitives/docs/components/avatar
Instance Method Summary collapse
-
#initialize(src:, alt: "", classes: "", **attributes) ⇒ AvatarImage
constructor
A new instance of AvatarImage.
- #view_template ⇒ Object
Methods included from AvatarImageBehavior
#avatar_image_classes, #avatar_image_data_attributes, #avatar_image_html_attributes
Constructor Details
#initialize(src:, alt: "", classes: "", **attributes) ⇒ AvatarImage
Returns a new instance of AvatarImage.
23 24 25 26 27 28 |
# File 'app/components/ui/avatar_image.rb', line 23 def initialize(src:, alt: "", classes: "", **attributes) @src = src @alt = alt @classes = classes @attributes = attributes end |
Instance Method Details
#view_template ⇒ Object
30 31 32 |
# File 'app/components/ui/avatar_image.rb', line 30 def view_template img(**avatar_image_html_attributes.deep_merge(@attributes)) end |