Class: PhlexKit::AttachmentMedia
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- PhlexKit::AttachmentMedia
- Defined in:
- app/components/phlex_kit/attachment/attachment_media.rb
Overview
Media slot of an Attachment: variant: :icon (default, a muted tile) or
:image (render an inside; fills the slot, full-width when the
attachment is vertical). See attachment.rb.
Constant Summary collapse
- VARIANTS =
{ icon: nil, image: "image" }.freeze
Instance Method Summary collapse
-
#initialize(variant: :icon, **attrs) ⇒ AttachmentMedia
constructor
A new instance of AttachmentMedia.
- #view_template ⇒ Object
Methods inherited from BaseComponent
Constructor Details
#initialize(variant: :icon, **attrs) ⇒ AttachmentMedia
Returns a new instance of AttachmentMedia.
8 9 10 11 |
# File 'app/components/phlex_kit/attachment/attachment_media.rb', line 8 def initialize(variant: :icon, **attrs) @variant = variant.to_sym @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
13 14 15 |
# File 'app/components/phlex_kit/attachment/attachment_media.rb', line 13 def view_template(&) div(**mix({ class: [ "pk-attachment-media", fetch_option(VARIANTS, @variant, :variant) ].compact.join(" ") }, @attrs), &) end |