Class: Shadcn::Empty::Media::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Empty::Media::Component
- Defined in:
- app/components/shadcn/empty/media/component.rb
Overview
EmptyMedia. Named after the TSX function, but the data-slot it emits
is empty-icon — the two differ upstream, and the slot is what the
sibling selectors key on.
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #element_attributes(**defaults) ⇒ Object
-
#initialize(variant: :default, **attributes) ⇒ Component
constructor
A new instance of Component.
- #style_variants ⇒ Object
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #tag_name
Constructor Details
#initialize(variant: :default, **attributes) ⇒ Component
Returns a new instance of Component.
33 34 35 36 |
# File 'app/components/shadcn/empty/media/component.rb', line 33 def initialize(variant: :default, **attributes) @variant = variant&.to_sym || :default super(**attributes) end |
Instance Attribute Details
#variant ⇒ Object (readonly)
Returns the value of attribute variant.
31 32 33 |
# File 'app/components/shadcn/empty/media/component.rb', line 31 def variant @variant end |
Instance Method Details
#element_attributes(**defaults) ⇒ Object
42 43 44 |
# File 'app/components/shadcn/empty/media/component.rb', line 42 def element_attributes(**defaults) super(**{ "data-variant" => variant }.merge(defaults)) end |
#style_variants ⇒ Object
38 39 40 |
# File 'app/components/shadcn/empty/media/component.rb', line 38 def style_variants { variant: } end |