Class: PhlexKit::ResizablePanel

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

Overview

One pane of a ResizablePanelGroup. default_size: is a percentage. See resizable_panel_group.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(default_size: nil, **attrs) ⇒ ResizablePanel

Returns a new instance of ResizablePanel.



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

def initialize(default_size: nil, **attrs)
  @default_size = default_size
  @attrs = attrs
end

Instance Method Details

#view_templateObject



10
11
12
13
14
15
16
17
# File 'app/components/phlex_kit/resizable/resizable_panel.rb', line 10

def view_template(&)
  style = @default_size ? "flex-grow: #{@default_size}" : nil
  div(**mix({
    class: "pk-resizable-panel",
    style: style,
    data: { phlex_kit__resizable_target: "panel" }
  }.compact, @attrs), &)
end