Class: Shadcn::SidebarMenuActionComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/shadcn/sidebar_menu_action_component.rb

Overview

SidebarMenuAction component - action button within menu item

Constant Summary collapse

BASE_CLASSES =
"absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0"
COLLAPSED_CLASSES =
"group-data-[collapsible=icon]:hidden"
SHOW_ON_HOVER_CLASSES =
"after:absolute after:-inset-2 after:md:hidden group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0"

Instance Attribute Summary

Attributes inherited from BaseComponent

#class_name, #data, #html_options

Instance Method Summary collapse

Methods inherited from BaseComponent

#content

Methods included from Rails::Helpers::ClassNameHelper

#cn

Constructor Details

#initialize(show_on_hover: false, **options) ⇒ SidebarMenuActionComponent

Returns a new instance of SidebarMenuActionComponent.



10
11
12
13
# File 'app/components/shadcn/sidebar_menu_action_component.rb', line 10

def initialize(show_on_hover: false, **options)
  super(**options)
  @show_on_hover = show_on_hover
end

Instance Method Details

#callObject



15
16
17
# File 'app/components/shadcn/sidebar_menu_action_component.rb', line 15

def call
  (:button, content, action_attributes)
end