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_html_classes, #polaris_html_styles, #polaris_icon_source

Methods included from StylesListHelper

#styles_list

Methods included from OptionHelper

#append_option, #prepend_option

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #fetch_or_fallback_nested

Methods included from ClassNameHelper

#class_names

Constructor Details

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

Returns a new instance of ActionGroupComponent.



120
121
122
123
# File 'app/components/polaris/page_component.rb', line 120

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

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



118
119
120
# File 'app/components/polaris/page_component.rb', line 118

def actions
  @actions
end

#titleObject (readonly)

Returns the value of attribute title.



117
118
119
# File 'app/components/polaris/page_component.rb', line 117

def title
  @title
end

Instance Method Details

#callObject



125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'app/components/polaris/page_component.rb', line 125

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

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