Class: Railsboot::SpinnerComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::SpinnerComponent
- Defined in:
- app/components/railsboot/spinner_component.rb
Overview
ViewComponent: renders the spinner block.
Constant Summary collapse
- STYLES =
Styles.
%w[border grow].freeze
- DEFAULT_STYLE =
Default style.
"border".freeze
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.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/components/railsboot/spinner_component.rb', line 9 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 |