Class: Shadcn::EmptyMediaComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::EmptyMediaComponent
- Defined in:
- app/components/shadcn/empty_media_component.rb
Overview
Empty Media component - displays icon, image, or avatar
Constant Summary collapse
- VARIANTS =
{ default: "", icon: "flex size-12 items-center justify-center rounded-full bg-muted [&>svg]:size-6 [&>svg]:text-muted-foreground" }.freeze
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(variant: :default, **options) ⇒ EmptyMediaComponent
constructor
A new instance of EmptyMediaComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(variant: :default, **options) ⇒ EmptyMediaComponent
Returns a new instance of EmptyMediaComponent.
12 13 14 15 |
# File 'app/components/shadcn/empty_media_component.rb', line 12 def initialize(variant: :default, **) super(**) @variant = variant.to_sym end |
Instance Method Details
#call ⇒ Object
17 18 19 |
# File 'app/components/shadcn/empty_media_component.rb', line 17 def call content_tag(:div, content, class: merge_classes(VARIANTS[@variant]), **.merge(build_data)) end |