Class: Primer::ProgressBarComponent::Item

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ClassNameHelper

#class_names

Constructor Details

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

Returns a new instance of Item.



55
56
57
58
59
60
61
62
63
# File 'app/components/primer/progress_bar_component.rb', line 55

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

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

Instance Attribute Details

#kwargsObject (readonly)

Returns the value of attribute kwargs.



53
54
55
# File 'app/components/primer/progress_bar_component.rb', line 53

def kwargs
  @kwargs
end