Class: PhlexKit::Message

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

Overview

Chat message row (avatar + content), ported from ruby_ui's RubyUI::Message. align: :end reverses the row. Compose Message > MessageContent (+ Avatar/ Header/Footer); group several in a MessageGroup.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(align: :start, **attrs) ⇒ Message

Returns a new instance of Message.



6
7
8
9
# File 'app/components/phlex_kit/message/message.rb', line 6

def initialize(align: :start, **attrs)
  @align = align.to_sym
  @attrs = attrs
end

Instance Method Details

#view_templateObject



10
11
12
# File 'app/components/phlex_kit/message/message.rb', line 10

def view_template(&)
  div(**mix({ class: "pk-message", data: { slot: "message", align: @align } }, @attrs), &)
end