Class: UI::AvatarFallback
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::AvatarFallback
- Includes:
- AvatarFallbackBehavior
- Defined in:
- app/components/ui/avatar_fallback.rb
Overview
Avatar Fallback - Phlex implementation
Displays fallback content when the image hasn't loaded or fails to load. Uses AvatarFallbackBehavior module for shared styling logic.
Based on shadcn/ui Avatar: https://ui.shadcn.com/docs/components/avatar Based on Radix UI Avatar: https://www.radix-ui.com/primitives/docs/components/avatar
Instance Method Summary collapse
-
#initialize(classes: "", **attributes) ⇒ AvatarFallback
constructor
A new instance of AvatarFallback.
- #view_template(&block) ⇒ Object
Methods included from AvatarFallbackBehavior
#avatar_fallback_classes, #avatar_fallback_data_attributes, #avatar_fallback_html_attributes
Constructor Details
#initialize(classes: "", **attributes) ⇒ AvatarFallback
Returns a new instance of AvatarFallback.
23 24 25 26 |
# File 'app/components/ui/avatar_fallback.rb', line 23 def initialize(classes: "", **attributes) @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
28 29 30 31 32 |
# File 'app/components/ui/avatar_fallback.rb', line 28 def view_template(&block) span(**avatar_fallback_html_attributes.deep_merge(@attributes)) do yield if block_given? end end |