Class: Primer::OpenProject::PageHeader::PageHeaderActionMenu

Inherits:
Component
  • Object
show all
Defined in:
app/components/primer/open_project/page_header.rb

Overview

A Helper class to create ActionMenus inside the PageHeader action slot

Constant Summary

Constants inherited from Component

Component::INVALID_ARIA_LABEL_TAGS

Constants included from Status::Dsl

Status::Dsl::STATUSES

Constants included from ViewHelper

ViewHelper::HELPERS

Constants included from TestSelectorHelper

TestSelectorHelper::TEST_SELECTOR_TAG

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Constants included from AttributesHelper

AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES

Instance Method Summary collapse

Methods inherited from Component

deprecated?, generate_id

Methods included from JoinStyleArgumentsHelper

#join_style_arguments

Methods included from TestSelectorHelper

#add_test_selector

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?

Methods included from ClassNameHelper

#class_names

Methods included from AttributesHelper

#aria, #data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes

Methods included from ExperimentalSlotHelpers

included

Methods included from ExperimentalRenderHelpers

included

Constructor Details

#initialize(menu_arguments: {}, button_arguments: {}) ⇒ PageHeaderActionMenu

Returns a new instance of PageHeaderActionMenu.

Parameters:

  • menu_arguments (Hash) (defaults to: {})

    The arguments accepted by <%= link_to_component(Primer::Alpha::ActionMenu) %>.

  • button_arguments (Hash) (defaults to: {})

    The arguments accepted by <%= link_to_component(Primer::Beta::Button) %> or <%= link_to_component(Primer::Beta::IconButton) %>, depending on the value of the ‘icon:` argument.



263
264
265
266
# File 'app/components/primer/open_project/page_header.rb', line 263

def initialize(menu_arguments: {}, button_arguments: {})
  @menu = Primer::Alpha::ActionMenu.new(**menu_arguments)
  @button = @menu.with_show_button(icon: "triangle-down", **button_arguments)
end

Instance Method Details

#before_renderObject



274
275
276
# File 'app/components/primer/open_project/page_header.rb', line 274

def before_render
  content
end

#callObject



278
279
280
# File 'app/components/primer/open_project/page_header.rb', line 278

def call
  render(@menu)
end

#render_in(view_context, &block) ⇒ Object



268
269
270
271
272
# File 'app/components/primer/open_project/page_header.rb', line 268

def render_in(view_context, &block)
  super(view_context) do
    block.call(@menu, @button)
  end
end