Class: UI::SkeletonComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/view_components/ui/skeleton_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(**attributes) ⇒ SkeletonComponent

Returns a new instance of SkeletonComponent.



4
5
6
# File 'app/view_components/ui/skeleton_component.rb', line 4

def initialize(**attributes)
  @attributes = attributes
end

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/view_components/ui/skeleton_component.rb', line 8

def call
  attrs = component_html_attributes.deep_merge(@attributes)

  # Merge Tailwind classes intelligently
  attrs[:class] = TailwindMerge::Merger.new.merge([
    component_html_attributes[:class],
    @attributes[:class]
  ].compact.join(" "))

   :div, "", **attrs
end