Class: Railsboot::RatingGroupComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::RatingGroupComponent
- Defined in:
- app/components/railsboot/rating_group_component.rb
Defined Under Namespace
Classes: BackgroundIconComponent, FillIconComponent
Constant Summary collapse
- DEFAULT_AMOUNT =
5
Instance Method Summary collapse
-
#initialize(amount: DEFAULT_AMOUNT, value: 0, background_color: "black", fill_color: "primary", gap: 0, **html_attributes) ⇒ RatingGroupComponent
constructor
A new instance of RatingGroupComponent.
- #render? ⇒ Boolean
Constructor Details
#initialize(amount: DEFAULT_AMOUNT, value: 0, background_color: "black", fill_color: "primary", gap: 0, **html_attributes) ⇒ RatingGroupComponent
Returns a new instance of RatingGroupComponent.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/components/railsboot/rating_group_component.rb', line 7 def initialize(amount: DEFAULT_AMOUNT, value: 0, background_color: "black", fill_color: "primary", gap: 0, **html_attributes) @amount = amount @value = value @background_color = background_color @fill_color = fill_color @gap = gap @html_attributes = html_attributes @html_attributes[:class] = class_names( "position-relative d-inline-flex text-#{@background_color} gap-#{@gap}", html_attributes[:class] ) end |
Instance Method Details
#render? ⇒ Boolean
21 22 23 |
# File 'app/components/railsboot/rating_group_component.rb', line 21 def render? [background_icon, fill_icon].all?(&:present?) end |