Class: Anchor::LoadingIndicatorComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/anchor/loading_indicator_component.rb

Constant Summary collapse

VARIANT_MAPPING =
{
  sm: "w-4 h-4 border-[1.5px]",
  md: "w-6 h-6 border-2",
  lg: "w-12 h-12 border-4",
}.freeze
VARIANT_DEFAULT =
:md
VARIANT_OPTIONS =
VARIANT_MAPPING.keys

Instance Method Summary collapse

Methods inherited from Component

generate_id

Methods included from ViewHelper

#text_prose

Methods included from FetchOrFallbackHelper

#fetch_or_fallback

Constructor Details

#initialize(variant: VARIANT_DEFAULT, **kwargs) ⇒ LoadingIndicatorComponent

Returns a new instance of LoadingIndicatorComponent.



11
12
13
14
15
16
17
# File 'app/components/anchor/loading_indicator_component.rb', line 11

def initialize(variant: VARIANT_DEFAULT, **kwargs)
  @variant = VARIANT_MAPPING[
    fetch_or_fallback(VARIANT_OPTIONS, variant, VARIANT_DEFAULT)
  ]

  super
end