Class: Primer::Beta::BorderBox
- Defined in:
- app/components/primer/beta/border_box.rb,
app/components/primer/beta/border_box/header.rb
Overview
‘BorderBox` is a Box component with a border.
Defined Under Namespace
Classes: Header
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
Constants included from AttributesHelper
AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Method Summary collapse
-
#initialize(padding: DEFAULT_PADDING, **system_arguments) ⇒ BorderBox
constructor
A new instance of BorderBox.
- #render? ⇒ Boolean
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(padding: DEFAULT_PADDING, **system_arguments) ⇒ BorderBox
Returns a new instance of BorderBox.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'app/components/primer/beta/border_box.rb', line 75 def initialize(padding: DEFAULT_PADDING, **system_arguments) list_id = system_arguments.delete(:list_id) @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 } @list_arguments = { tag: :ul } @list_arguments[:id] = list_id if list_id end |
Instance Method Details
#render? ⇒ Boolean
91 92 93 |
# File 'app/components/primer/beta/border_box.rb', line 91 def render? rows.any? || header.present? || body.present? || .present? end |