Class: Polaris::ResourceItem::ShortcutActionsComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/polaris/resource_item/shortcut_actions_component.rb

Defined Under Namespace

Classes: ShortcutActionsButtonComponent

Instance Method Summary collapse

Constructor Details

#initialize(persist_actions: false, wrapper_arguments: {}, disclosure_arguments: {}, popover_arguments: {}, **system_arguments) ⇒ ShortcutActionsComponent

Returns a new instance of ShortcutActionsComponent.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/components/polaris/resource_item/shortcut_actions_component.rb', line 9

def initialize(
  persist_actions: false,
  wrapper_arguments: {},
  disclosure_arguments: {},
  popover_arguments: {},
  **system_arguments
)
  @persist_actions = persist_actions
  @wrapper_arguments = wrapper_arguments
  @disclosure_arguments = disclosure_arguments
  @popover_arguments = popover_arguments
  @system_arguments = system_arguments
end

Instance Method Details

#disclosure_argumentsObject



33
34
35
36
37
38
39
40
41
# File 'app/components/polaris/resource_item/shortcut_actions_component.rb', line 33

def disclosure_arguments
  @disclosure_arguments.tap do |opts|
    opts[:tag] = "div"
    opts[:classes] = class_names(
      @disclosure_arguments[:classes],
      "Polaris-ResourceItem__Disclosure"
    )
  end
end

#popover_argumentsObject



43
44
45
46
47
48
49
# File 'app/components/polaris/resource_item/shortcut_actions_component.rb', line 43

def popover_arguments
  {
    alignment: :right,
    position: :below,
    append_to_body: true
  }.deep_merge(@popover_arguments)
end

#system_argumentsObject



51
52
53
54
55
# File 'app/components/polaris/resource_item/shortcut_actions_component.rb', line 51

def system_arguments
  @system_arguments.tap do |opts|
    opts[:segmented] = !@persist_actions
  end
end

#wrapper_argumentsObject



23
24
25
26
27
28
29
30
31
# File 'app/components/polaris/resource_item/shortcut_actions_component.rb', line 23

def wrapper_arguments
  @wrapper_arguments.tap do |opts|
    opts[:tag] = "div"
    opts[:classes] = class_names(
      @wrapper_arguments[:classes],
      "Polaris-ResourceItem__Actions"
    )
  end
end