Class: Primer::Beta::Blankslate
- Defined in:
- app/components/primer/beta/blankslate.rb
Overview
Use ‘Blankslate` when there is a lack of content within a page or section. Use as placeholder to tell users why something isn’t there.
Constant Summary collapse
- VISUAL_OPTIONS =
%i[icon spinner image].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(narrow: false, spacious: false, border: false, **system_arguments) ⇒ Blankslate
constructor
A new instance of Blankslate.
- #render? ⇒ Boolean
- #wrapper ⇒ 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(narrow: false, spacious: false, border: false, **system_arguments) ⇒ Blankslate
Returns a new instance of Blankslate.
106 107 108 109 110 111 112 113 114 115 116 |
# File 'app/components/primer/beta/blankslate.rb', line 106 def initialize(narrow: false, spacious: false, border: false, **system_arguments) @border = border @system_arguments = deny_tag_argument(**system_arguments) @system_arguments[:tag] = :div @system_arguments[:classes] = class_names( @system_arguments[:classes], "blankslate", "blankslate-narrow": narrow, "blankslate-spacious": spacious ) end |
Instance Method Details
#render? ⇒ Boolean
118 119 120 |
# File 'app/components/primer/beta/blankslate.rb', line 118 def render? heading.present? end |
#wrapper ⇒ Object
122 123 124 125 126 127 128 129 130 131 |
# File 'app/components/primer/beta/blankslate.rb', line 122 def wrapper unless @border yield return # returning `yield` caused a double render end content_tag(:div, class: "Box") do yield if block_given? end end |