Class: Polaris::PageComponent::ActionGroupComponent

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

Constant Summary

Constants included from ViewHelper

ViewHelper::POLARIS_HELPERS, ViewHelper::POLARIS_TEXT_STYLES

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ViewHelper

#polaris_body_styles, #polaris_icon_source, #polaris_inversed_colors

Methods included from OptionHelper

#append_option, #prepend_option

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean

Methods included from ClassNameHelper

#class_names

Constructor Details

#initialize(title:, actions: []) ⇒ ActionGroupComponent

Returns a new instance of ActionGroupComponent.



100
101
102
103
# File 'app/components/polaris/page_component.rb', line 100

def initialize(title:, actions: [])
  @title = title
  @actions = actions
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



98
99
100
# File 'app/components/polaris/page_component.rb', line 98

def actions
  @actions
end

#titleObject (readonly)

Returns the value of attribute title.



97
98
99
# File 'app/components/polaris/page_component.rb', line 97

def title
  @title
end

Instance Method Details

#callObject



105
106
107
108
109
110
111
112
113
114
115
# File 'app/components/polaris/page_component.rb', line 105

def call
  render(Polaris::PopoverComponent.new(position: :below)) do |popover|
    popover.button(disclosure: true) { @title }

    polaris_action_list do |list|
      @actions.each do |action|
        list.item(**action) { action[:content] }
      end
    end
  end
end