Class: PhlexKit::Attachment

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/attachment/attachment.rb

Overview

File chip, ported from shadcn/ui's Attachment (an AI-chat-era addition, not in ruby_ui): a bordered row of AttachmentMedia (icon or image preview) + AttachmentContent(AttachmentTitle + AttachmentDescription) + AttachmentActions(AttachmentAction — e.g. a remove ×). .pk-attachment* (attachment.css).

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ Attachment

Returns a new instance of Attachment.



8
9
10
# File 'app/components/phlex_kit/attachment/attachment.rb', line 8

def initialize(**attrs)
  @attrs = attrs
end

Instance Method Details

#view_templateObject



12
13
14
# File 'app/components/phlex_kit/attachment/attachment.rb', line 12

def view_template(&)
  div(**mix({ class: "pk-attachment" }, @attrs), &)
end