Class: PhlexKit::ResizableHandle

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

Overview

Drag handle between two ResizablePanels. with_handle: true shows the visible grip pill (their withHandle). See resizable_panel_group.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(with_handle: false, **attrs) ⇒ ResizableHandle

Returns a new instance of ResizableHandle.



5
6
7
8
# File 'app/components/phlex_kit/resizable/resizable_handle.rb', line 5

def initialize(with_handle: false, **attrs)
  @with_handle = with_handle
  @attrs = attrs
end

Instance Method Details

#view_templateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/components/phlex_kit/resizable/resizable_handle.rb', line 10

def view_template
  div(**mix({
    class: "pk-resizable-handle",
    role: "separator",
    tabindex: "0",
    aria: { orientation: "vertical" },
    data: {
      phlex_kit__resizable_target: "handle",
      action: "pointerdown->phlex-kit--resizable#start"
    }
  }, @attrs)) do
    span(class: "pk-resizable-handle-grip", aria: { hidden: "true" }) if @with_handle
  end
end