Class: Primer::Beta::ProgressBar

Inherits:
Component
  • Object
show all
Defined in:
app/components/primer/beta/progress_bar.rb

Overview

Use ‘ProgressBar` to visualize task completion.

Constant Summary collapse

SIZE_DEFAULT =
:default
SIZE_MAPPINGS =
{
  SIZE_DEFAULT => "",
  :small => "Progress--small",
  :large => "Progress--large"
}.freeze
SIZE_OPTIONS =
SIZE_MAPPINGS.keys

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, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes

Constructor Details

#initialize(size: SIZE_DEFAULT, **system_arguments) ⇒ ProgressBar

Returns a new instance of ProgressBar.

Parameters:

  • size (Symbol) (defaults to: SIZE_DEFAULT)

    <%= one_of(Primer::Beta::ProgressBar::SIZE_OPTIONS) %> Increases height.

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



36
37
38
39
40
41
42
43
44
# File 'app/components/primer/beta/progress_bar.rb', line 36

def initialize(size: SIZE_DEFAULT, **system_arguments)
  @system_arguments = deny_tag_argument(**system_arguments)
  @system_arguments[:classes] = class_names(
    @system_arguments[:classes],
    "Progress",
    SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)]
  )
  @system_arguments[:tag] = :span
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'app/components/primer/beta/progress_bar.rb', line 46

def render?
  items?
end