Class: Shadcn::Spinner::Component

Inherits:
Icon::Component show all
Defined in:
app/components/shadcn/spinner/component.rb

Overview

Port of registry/new-york-v4/ui/spinner.tsx — the lucide Loader2 icon with a status role.

Constant Summary

Constants inherited from Icon::Component

Icon::Component::SVG_ATTRIBUTES

Constants inherited from ApplicationViewComponent

ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS

Instance Attribute Summary

Attributes inherited from Icon::Component

#name

Attributes inherited from ApplicationViewComponent

#attributes

Instance Method Summary collapse

Methods inherited from Icon::Component

#call, #path

Methods inherited from ApplicationViewComponent

#call, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name

Constructor Details

#initialize(**attributes) ⇒ Component

Returns a new instance of Component.



8
9
10
# File 'app/components/shadcn/spinner/component.rb', line 8

def initialize(**attributes)
  super("loader-2", **attributes)
end

Instance Method Details

#css_classes(extra = nil) ⇒ Object



16
17
18
# File 'app/components/shadcn/spinner/component.rb', line 16

def css_classes(extra = nil)
  super(ShadcnViewComponent.cn("size-4 animate-spin", extra))
end

#element_attributes(**defaults) ⇒ Object



12
13
14
# File 'app/components/shadcn/spinner/component.rb', line 12

def element_attributes(**defaults)
  super(**{ role: "status", "aria-label" => shadcn_t("spinner.loading") }.merge(defaults))
end