Class: Primer::Dropdown::MenuComponent
- Defined in:
- app/components/primer/dropdown/menu_component.rb
Overview
This component is part of ‘Primer::DropdownComponent` and should not be used as a standalone component.
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 included from Status::Dsl
Constants included from ViewHelper
Constants included from TestSelectorHelper
TestSelectorHelper::TEST_SELECTOR_TAG
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Method Summary collapse
-
#initialize(direction: DIRECTION_DEFAULT, scheme: SCHEME_DEFAULT, header: nil, **system_arguments) ⇒ MenuComponent
constructor
A new instance of MenuComponent.
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Constructor Details
#initialize(direction: DIRECTION_DEFAULT, scheme: SCHEME_DEFAULT, header: nil, **system_arguments) ⇒ MenuComponent
Returns a new instance of MenuComponent.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/components/primer/dropdown/menu_component.rb', line 29 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 |