Class: Railsboot::RatingGroupComponent::FillIconComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::RatingGroupComponent::FillIconComponent
- Defined in:
- app/components/railsboot/rating_group_component.rb
Instance Method Summary collapse
-
#initialize(amount:, value:, fill_color:, gap:, **html_attributes) ⇒ FillIconComponent
constructor
A new instance of FillIconComponent.
Constructor Details
#initialize(amount:, value:, fill_color:, gap:, **html_attributes) ⇒ FillIconComponent
Returns a new instance of FillIconComponent.
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/components/railsboot/rating_group_component.rb', line 32 def initialize(amount:, value:, fill_color:, gap:, **html_attributes) @amount = amount @value = value @fill_color = fill_color @gap = gap @html_attributes = html_attributes @html_attributes[:class] = class_names( "position-absolute top-0 bottom-0 start-0 d-inline-flex text-#{@fill_color} overflow-hidden gap-#{@gap}", html_attributes.delete(:class) ) @html_attributes[:style] = [html_attributes[:style], "width: #{@value}%;"].compact.join(" ") end |