Class: Railsboot::SpinnerComponent
- Defined in:
- app/components/railsboot/spinner_component.rb
Constant Summary collapse
- STYLES =
["border", "grow"].freeze
- DEFAULT_STYLE =
"border".freeze
Constants inherited from Component
Component::COLORS, Component::DEFAULT_COLOR
Instance Method Summary collapse
-
#initialize(style: DEFAULT_STYLE, color: DEFAULT_COLOR, **html_attributes) ⇒ SpinnerComponent
constructor
A new instance of SpinnerComponent.
Constructor Details
#initialize(style: DEFAULT_STYLE, color: DEFAULT_COLOR, **html_attributes) ⇒ SpinnerComponent
Returns a new instance of SpinnerComponent.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/components/railsboot/spinner_component.rb', line 5 def initialize(style: DEFAULT_STYLE, color: DEFAULT_COLOR, **html_attributes) @style = fetch_or_raise(style, STYLES) @color = fetch_or_raise(color, COLORS) @html_attributes = html_attributes @html_attributes[:tag] = "div" @html_attributes[:class] = class_names( "spinner-#{@style}", "text-#{@color}", html_attributes.delete(:class) ) end |