Class: RubyUI::SidebarMenuSkeleton

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_ui/sidebar/sidebar_menu_skeleton.rb

Constant Summary

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Constructor Details

#initialize(show_icon: false, **attrs) ⇒ SidebarMenuSkeleton

Returns a new instance of SidebarMenuSkeleton.



5
6
7
8
# File 'lib/ruby_ui/sidebar/sidebar_menu_skeleton.rb', line 5

def initialize(show_icon: false, **attrs)
  @show_icon = show_icon
  super(**attrs)
end

Instance Method Details

#view_templateObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/ruby_ui/sidebar/sidebar_menu_skeleton.rb', line 10

def view_template(&)
  div(**attrs) do
    Skeleton(class: "size-4 rounded-md", data: {sidebar: "menu-skeleton-icon"}) if @show_icon
    Skeleton(
      class: "h-4 max-w-[var(--skeleton-width)] flex-1",
      data: {sidebar: "menu-skeleton-text"},
      style: {"--skeleton-width" => "#{skeleton_width}%"}
    )
  end
end