Class: Primer::DropdownMenuComponent
- Defined in:
- app/components/primer/dropdown_menu_component.rb
Overview
DropdownMenus are lightweight context menus for housing navigation and actions. They’re great for instances where you don’t need the full power (and code) of the select menu.
Constant Summary collapse
- SCHEME_DEFAULT =
:default- SCHEME_MAPPINGS =
{ SCHEME_DEFAULT => "", :dark => "dropdown-menu-dark" }.freeze
- DIRECTION_DEFAULT =
:se- DIRECTION_OPTIONS =
[DIRECTION_DEFAULT, :sw, :w, :e, :ne, :s].freeze
Constants inherited from Component
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(direction: DIRECTION_DEFAULT, scheme: SCHEME_DEFAULT, header: nil, **system_arguments) ⇒ DropdownMenuComponent
constructor
A new instance of DropdownMenuComponent.
Methods included from ViewHelper
Methods included from JoinStyleArgumentsHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean
Methods included from ClassNameHelper
Constructor Details
#initialize(direction: DIRECTION_DEFAULT, scheme: SCHEME_DEFAULT, header: nil, **system_arguments) ⇒ DropdownMenuComponent
Returns a new instance of DropdownMenuComponent.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/components/primer/dropdown_menu_component.rb', line 44 def initialize(direction: DIRECTION_DEFAULT, scheme: SCHEME_DEFAULT, header: nil, **system_arguments) @header = header @direction = direction @system_arguments = system_arguments @system_arguments[:tag] = "details-menu" @system_arguments[:role] = "menu" @system_arguments[:classes] = class_names( @system_arguments[:classes], "dropdown-menu", "dropdown-menu-#{fetch_or_fallback(DIRECTION_OPTIONS, direction, DIRECTION_DEFAULT)}", SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_MAPPINGS.keys, scheme, SCHEME_DEFAULT)] ) end |
Class Method Details
.status ⇒ Object
17 18 19 |
# File 'app/components/primer/dropdown_menu_component.rb', line 17 def self.status STATUSES[:deprecated] end |