Class: Primer::ProgressBarComponent
- Includes:
- ViewComponent::Slotable
- Defined in:
- app/components/primer/progress_bar_component.rb
Defined Under Namespace
Classes: Item
Constant Summary collapse
- SIZE_DEFAULT =
:default- SIZE_MAPPINGS =
{ SIZE_DEFAULT => "", :small => "Progress--small", :large => "Progress--large", }.freeze
- SIZE_OPTIONS =
SIZE_MAPPINGS.keys
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Method Summary collapse
-
#initialize(size: SIZE_DEFAULT, percentage: 0, **kwargs) ⇒ ProgressBarComponent
constructor
A new instance of ProgressBarComponent.
- #render? ⇒ Boolean
Methods included from FetchOrFallbackHelper
Methods included from ClassNameHelper
Constructor Details
#initialize(size: SIZE_DEFAULT, percentage: 0, **kwargs) ⇒ ProgressBarComponent
Returns a new instance of ProgressBarComponent.
36 37 38 39 40 41 42 43 44 45 |
# File 'app/components/primer/progress_bar_component.rb', line 36 def initialize(size: SIZE_DEFAULT, percentage: 0, **kwargs) @kwargs = kwargs @kwargs[:classes] = class_names( @kwargs[:classes], "Progress", SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)] ) @kwargs[:tag] = :span end |
Instance Method Details
#render? ⇒ Boolean
47 48 49 |
# File 'app/components/primer/progress_bar_component.rb', line 47 def render? items.any? end |