Class: Polaris::PageComponent::ActionGroupComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Polaris::PageComponent::ActionGroupComponent
- 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
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(title:, actions: []) ⇒ ActionGroupComponent
constructor
A new instance of ActionGroupComponent.
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
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
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
98 99 100 |
# File 'app/components/polaris/page_component.rb', line 98 def actions @actions end |
#title ⇒ Object (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
#call ⇒ Object
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.(disclosure: true) { @title } polaris_action_list do |list| @actions.each do |action| list.item(**action) { action[:content] } end end end end |