Class: Railsboot::RatingGroupComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::RatingGroupComponent
- Defined in:
- app/components/railsboot/rating_group_component.rb
Overview
ViewComponent: renders the rating group block.
Defined Under Namespace
Classes: BackgroundIconComponent, FillIconComponent
Constant Summary collapse
- DEFAULT_AMOUNT =
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.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/components/railsboot/rating_group_component.rb', line 10 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
24 25 26 |
# File 'app/components/railsboot/rating_group_component.rb', line 24 def render? [background_icon, fill_icon].all?(&:present?) end |