Class: Primer::ProgressBarComponent::Item

Inherits:
Slot
  • Object
show all
Defined in:
app/components/primer/progress_bar_component.rb

Overview

:nodoc:

Constant Summary

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from JoinStyleArgumentsHelper

#join_style_arguments

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean

Methods included from ClassNameHelper

#class_names

Constructor Details

#initialize(percentage: 0, bg: :green, **system_arguments) ⇒ Item

Returns a new instance of Item.

Parameters:

  • percentage (Integer) (defaults to: 0)

    Percentage completion of item.

  • bg (Symbol) (defaults to: :green)

    Color of item.

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



64
65
66
67
68
69
70
71
72
73
# File 'app/components/primer/progress_bar_component.rb', line 64

def initialize(percentage: 0, bg: :green, **system_arguments)
  @percentage = percentage
  @system_arguments = system_arguments

  @system_arguments[:tag] = :span
  @system_arguments[:bg] = bg
  @system_arguments[:style] =
    join_style_arguments(@system_arguments[:style], "width: #{@percentage}%;")
  @system_arguments[:classes] = class_names("Progress-item", @system_arguments[:classes])
end

Instance Attribute Details

#system_argumentsObject (readonly)

Returns the value of attribute system_arguments.



59
60
61
# File 'app/components/primer/progress_bar_component.rb', line 59

def system_arguments
  @system_arguments
end