Class: FoxTail::SpinnerComponent

Inherits:
InlineSvgComponent show all
Defined in:
app/components/fox_tail/spinner_component.rb

Instance Attribute Summary

Attributes inherited from InlineSvgComponent

#path

Attributes inherited from BaseComponent

#html_attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from InlineSvgComponent

#call

Methods inherited from BaseComponent

classname_merger, stimulus_merger, use_stimulus?, #with_html_attributes, #with_html_class

Methods inherited from Base

fox_tail_config

Constructor Details

#initialize(html_attributes = {}) ⇒ SpinnerComponent

Returns a new instance of SpinnerComponent.



7
8
9
10
# File 'app/components/fox_tail/spinner_component.rb', line 7

def initialize(html_attributes = {})
  path = html_attributes.delete(:path) { self.class.spinner_path }
  super(path, html_attributes)
end

Class Method Details

.spinner_pathObject



24
25
26
# File 'app/components/fox_tail/spinner_component.rb', line 24

def spinner_path
  FoxTail.root.join "app/assets/vendor/spinner.svg"
end

Instance Method Details

#before_renderObject



12
13
14
15
16
17
# File 'app/components/fox_tail/spinner_component.rb', line 12

def before_render
  super

  html_attributes[:"aria-hidden"] = true
  html_attributes[:role] = :status
end

#html_classObject



19
20
21
# File 'app/components/fox_tail/spinner_component.rb', line 19

def html_class
  classnames theme.apply(:root, self), super
end