Class: Primer::OpenProject::SubHeader
- Defined in:
- app/components/primer/open_project/sub_header.rb
Overview
The SubHeader contains specific actions to modify the page content below, e.g a filter button or a create button It should not be used stand alone, but in combination with a PageHeader, either as a direct sibling or as part of a tab content
Defined Under Namespace
Classes: Button, ButtonGroup, Menu, SegmentedControl
Constant Summary collapse
- HIDDEN_FILTER_TARGET_SELECTOR =
"sub-header.hiddenItemsOnExpandedFilter"- SHOWN_FILTER_TARGET_SELECTOR =
"sub-header.shownItemsOnExpandedFilter"- MOBILE_ACTIONS_DISPLAY =
[:flex, :none].freeze
- DESKTOP_ACTIONS_DISPLAY =
[:none, :flex].freeze
Constants inherited from Component
Component::INVALID_ARIA_LABEL_TAGS
Constants included from Status::Dsl
Constants included from ViewHelper
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
- #before_render ⇒ Object
-
#initialize(**system_arguments) ⇒ SubHeader
constructor
A new instance of SubHeader.
- #set_as_hidden_filter_target(system_arguments) ⇒ Object
Methods inherited from Component
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
Methods included from AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
#initialize(**system_arguments) ⇒ SubHeader
Returns a new instance of SubHeader.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'app/components/primer/open_project/sub_header.rb', line 199 def initialize(**system_arguments) @system_arguments = system_arguments @system_arguments[:tag] = :"sub-header" @filter_container = Primer::BaseComponent.new(tag: :div, classes: "SubHeader-filterContainer", display: DESKTOP_ACTIONS_DISPLAY, mr: 2, data: { targets: SHOWN_FILTER_TARGET_SELECTOR }) @system_arguments[:classes] = class_names( "SubHeader", system_arguments[:classes] ) end |
Instance Method Details
#before_render ⇒ Object
216 217 218 219 220 221 |
# File 'app/components/primer/open_project/sub_header.rb', line 216 def before_render @system_arguments[:classes] = class_names( @system_arguments[:classes], "SubHeader--emptyLeftPane" => !segmented_control? && ! && !filter_input ) end |
#set_as_hidden_filter_target(system_arguments) ⇒ Object
223 224 225 226 227 228 229 230 231 232 233 |
# File 'app/components/primer/open_project/sub_header.rb', line 223 def set_as_hidden_filter_target(system_arguments) system_arguments[:data] ||= {} system_arguments[:data] = merge_data( system_arguments, { data: { targets: HIDDEN_FILTER_TARGET_SELECTOR, } } ) system_arguments end |