Class: Pajamas::SpinnerComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/pajamas/spinner_component.rb

Constant Summary collapse

COLOR_OPTIONS =
[:light, :dark].freeze
SIZE_OPTIONS =
[:sm, :md, :lg, :xl].freeze

Instance Method Summary collapse

Constructor Details

#initialize(color: :dark, inline: false, label: _("Loading"), size: :sm, **html_options) ⇒ SpinnerComponent

Returns a new instance of SpinnerComponent.

Parameters:

  • color (Symbol) (defaults to: :dark)
  • inline (Boolean) (defaults to: false)
  • label (String) (defaults to: _("Loading"))
  • size (Symbol) (defaults to: :sm)


9
10
11
12
13
14
15
# File 'app/components/pajamas/spinner_component.rb', line 9

def initialize(color: :dark, inline: false, label: _("Loading"), size: :sm, **html_options)
  @color = filter_attribute(color.to_sym, COLOR_OPTIONS)
  @inline = inline
  @label = label.presence
  @size = filter_attribute(size.to_sym, SIZE_OPTIONS)
  @html_options = html_options
end