Class: Primer::BorderBoxComponent
- Defined in:
- app/components/primer/border_box_component.rb
Overview
‘BorderBox` is a Box component with a border.
Constant Summary collapse
- DEFAULT_PADDING =
:default- PADDING_MAPPINGS =
{ DEFAULT_PADDING => "", :condensed => "Box--condensed", :spacious => "Box--spacious" }.freeze
- PADDING_SUGGESTION =
"Perhaps you could consider using :padding options of #{PADDING_MAPPINGS.keys.to_sentence}?"- DEFAULT_ROW_SCHEME =
:default- ROW_SCHEME_MAPPINGS =
{ DEFAULT_ROW_SCHEME => "", :neutral => "Box-row--gray", :info => "Box-row--blue", :warning => "Box-row--yellow" }.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(padding: DEFAULT_PADDING, **system_arguments) ⇒ BorderBoxComponent
constructor
A new instance of BorderBoxComponent.
- #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(padding: DEFAULT_PADDING, **system_arguments) ⇒ BorderBoxComponent
Returns a new instance of BorderBoxComponent.
129 130 131 132 133 134 135 136 137 138 139 |
# File 'app/components/primer/border_box_component.rb', line 129 def initialize(padding: DEFAULT_PADDING, **system_arguments) @system_arguments = deny_tag_argument(**system_arguments) @system_arguments[:tag] = :div @system_arguments[:classes] = class_names( "Box", PADDING_MAPPINGS[fetch_or_fallback(PADDING_MAPPINGS.keys, padding, DEFAULT_PADDING)], system_arguments[:classes] ) @system_arguments[:system_arguments_denylist] = { [:p, :pt, :pb, :pr, :pl] => PADDING_SUGGESTION } end |
Instance Method Details
#render? ⇒ Boolean
141 142 143 |
# File 'app/components/primer/border_box_component.rb', line 141 def render? rows.any? || header.present? || body.present? || .present? end |