Class: Primer::DetailsComponent
- Defined in:
- app/components/primer/details_component.rb
Overview
Use ‘DetailsComponent` to reveal content after clicking a button.
Constant Summary collapse
- BODY_TAG_DEFAULT =
:div- BODY_TAG_OPTIONS =
[:ul, :"details-menu", :"details-dialog", BODY_TAG_DEFAULT].freeze
- NO_OVERLAY =
:none- OVERLAY_MAPPINGS =
{ NO_OVERLAY => "", :default => "details-overlay", :dark => "details-overlay details-overlay-dark" }.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
Instance Method Summary collapse
-
#initialize(overlay: NO_OVERLAY, reset: false, **system_arguments) ⇒ DetailsComponent
constructor
A new instance of DetailsComponent.
- #render? ⇒ Boolean
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(overlay: NO_OVERLAY, reset: false, **system_arguments) ⇒ DetailsComponent
Returns a new instance of DetailsComponent.
54 55 56 57 58 59 60 61 62 |
# File 'app/components/primer/details_component.rb', line 54 def initialize(overlay: NO_OVERLAY, reset: false, **system_arguments) @system_arguments = deny_tag_argument(**system_arguments) @system_arguments[:tag] = :details @system_arguments[:classes] = class_names( system_arguments[:classes], OVERLAY_MAPPINGS[fetch_or_fallback(OVERLAY_MAPPINGS.keys, , NO_OVERLAY)], "details-reset" => reset ) end |
Instance Method Details
#render? ⇒ Boolean
64 65 66 |
# File 'app/components/primer/details_component.rb', line 64 def render? summary.present? && body.present? end |