Class: Shadcn::AvatarFallbackComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::AvatarFallbackComponent
- Defined in:
- app/components/shadcn/avatar_fallback_component.rb
Overview
Avatar Fallback component for initials or placeholder
Constant Summary collapse
- FALLBACK_CLASSES =
"flex h-full w-full items-center justify-center rounded-full bg-muted"
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(class: nil, **options, &block) ⇒ AvatarFallbackComponent
constructor
A new instance of AvatarFallbackComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(class: nil, **options, &block) ⇒ AvatarFallbackComponent
8 9 10 11 |
# File 'app/components/shadcn/avatar_fallback_component.rb', line 8 def initialize(class: nil, **, &block) super(**, &block) @custom_class = binding.local_variable_get(:class) end |
Instance Method Details
#call ⇒ Object
13 14 15 |
# File 'app/components/shadcn/avatar_fallback_component.rb', line 13 def call content_tag(:span, content, class: cn(FALLBACK_CLASSES, @custom_class)) end |