Class: PhlexKit::ClipboardPopover

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

Constant Summary collapse

TARGETS =
{ success: "successPopover", error: "errorPopover" }.freeze

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(type:, **attrs) ⇒ ClipboardPopover

Returns a new instance of ClipboardPopover.



4
5
6
7
# File 'app/components/phlex_kit/clipboard/clipboard_popover.rb', line 4

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

Instance Method Details

#view_template(&block) ⇒ Object



8
9
10
11
12
# File 'app/components/phlex_kit/clipboard/clipboard_popover.rb', line 8

def view_template(&block)
  div(class: "pk-clipboard-popover pk-hidden", data: { phlex_kit__clipboard_target: fetch_option(TARGETS, @type, :target) }) do
    div(**mix({ class: "pk-clipboard-popover-inner" }, @attrs), &block)
  end
end