Class: Shadcn::Attachment::Media::Component
- Inherits:
-
Shadcn::ApplicationViewComponent
- Object
- ViewComponent::Base
- Shadcn::ApplicationViewComponent
- Shadcn::Attachment::Media::Component
- Defined in:
- app/components/shadcn/attachment/media/component.rb
Overview
AttachmentMedia — the square thumbnail: an icon, or the file itself.
Constant Summary
Constants inherited from Shadcn::ApplicationViewComponent
Shadcn::ApplicationViewComponent::CONTENTS_STYLE, Shadcn::ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Attributes inherited from Shadcn::ApplicationViewComponent
Instance Method Summary collapse
- #element_attributes(**defaults) ⇒ Object
-
#initialize(variant: :icon, **attributes) ⇒ Component
constructor
A new instance of Component.
- #style_variants ⇒ Object
Methods inherited from Shadcn::ApplicationViewComponent
#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #tag_name
Constructor Details
#initialize(variant: :icon, **attributes) ⇒ Component
Returns a new instance of Component.
41 42 43 44 |
# File 'app/components/shadcn/attachment/media/component.rb', line 41 def initialize(variant: :icon, **attributes) @variant = variant&.to_sym || :icon super(**attributes) end |
Instance Attribute Details
#variant ⇒ Object (readonly)
Returns the value of attribute variant.
39 40 41 |
# File 'app/components/shadcn/attachment/media/component.rb', line 39 def variant @variant end |
Instance Method Details
#element_attributes(**defaults) ⇒ Object
50 51 52 |
# File 'app/components/shadcn/attachment/media/component.rb', line 50 def element_attributes(**defaults) super(**{ "data-variant" => variant }.merge(defaults)) end |
#style_variants ⇒ Object
46 47 48 |
# File 'app/components/shadcn/attachment/media/component.rb', line 46 def style_variants { variant: } end |