Class: Primer::DropdownMenuComponent
- Defined in:
- app/components/primer/dropdown_menu_component.rb
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]
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
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 FetchOrFallbackHelper
Methods included from ClassNameHelper
Constructor Details
#initialize(direction: DIRECTION_DEFAULT, scheme: SCHEME_DEFAULT, header: nil, **system_arguments) ⇒ DropdownMenuComponent
Returns a new instance of DropdownMenuComponent.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/components/primer/dropdown_menu_component.rb', line 14 def initialize(direction: DIRECTION_DEFAULT, scheme: SCHEME_DEFAULT, header: nil, **system_arguments) @header, @direction, @system_arguments = header, direction, 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 |