Class: Primer::BlankslateComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/primer/blankslate_component.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

Constants inherited from Component

Component::INVALID_ARIA_LABEL_TAGS

Constants included from Status::Dsl

Status::Dsl::STATUSES

Constants included from ViewHelper

ViewHelper::HELPERS

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

Methods inherited from Component

deprecated?, generate_id

Methods included from JoinStyleArgumentsHelper

#join_style_arguments

Methods included from TestSelectorHelper

#add_test_selector

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?

Methods included from ClassNameHelper

#class_names

Methods included from AttributesHelper

#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes

Methods included from ExperimentalSlotHelpers

included

Methods included from ExperimentalRenderHelpers

included

Constructor Details

#initialize(title: "", title_tag: :h3, icon: "", icon_size: :medium, image_src: "", image_alt: " ", description: "", button_text: "", button_url: "", button_classes: "btn-primary my-3", link_text: "", link_url: "", narrow: false, large: false, spacious: false, **system_arguments) ⇒ BlankslateComponent



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'app/components/primer/blankslate_component.rb', line 35

def initialize(
  title: "",
  title_tag: :h3,
  icon: "",
  icon_size: :medium,
  image_src: "",
  image_alt: " ",
  description: "",
  button_text: "",
  button_url: "",
  button_classes: "btn-primary my-3",
  link_text: "",
  link_url: "",

  # variations
  narrow: false,
  large: false,
  spacious: false,

  **system_arguments
)
  @system_arguments = system_arguments
  @system_arguments[:tag] = :div
  @system_arguments[:classes] = class_names(
    @system_arguments[:classes],
    "blankslate",
    "blankslate-narrow": narrow,
    "blankslate-large": large,
    "blankslate-spacious": spacious
  )

  @title_tag = title_tag
  @icon = icon
  @icon_size = icon_size
  @image_src = image_src
  @image_alt = image_alt
  @title = title
  @description = description
  @button_text = button_text
  @button_url = button_url
  @button_classes = button_classes
  @link_text = link_text
  @link_url = link_url
end