Class: Panda::Core::Admin::Navigation::UserMenuComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/panda/core/admin/navigation/user_menu_component.rb

Overview

User profile menu component for the sidebar footer Displays user avatar/name with expandable menu for profile, security, and logout

Constant Summary collapse

BASE_CLASSES =
"transition-all group flex items-center w-full gap-x-3 px-3 py-2.5 " \
"text-sm font-medium cursor-pointer"
EXPANDED_BUTTON_CLASSES =
"bg-white/15 text-white rounded-t-xl"
INACTIVE_CLASSES =
"text-white/80 hover:bg-white/5 rounded-xl"

Constants inherited from Base

Base::TAILWIND_MERGER

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user:, active: false, **attrs) ⇒ UserMenuComponent

Returns a new instance of UserMenuComponent.



17
18
19
20
21
# File 'app/components/panda/core/admin/navigation/user_menu_component.rb', line 17

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

Instance Attribute Details

#userObject (readonly)

Returns the value of attribute user.



23
24
25
# File 'app/components/panda/core/admin/navigation/user_menu_component.rb', line 23

def user
  @user
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'app/components/panda/core/admin/navigation/user_menu_component.rb', line 25

def active?
  @active
end

#button_classesObject



29
30
31
# File 'app/components/panda/core/admin/navigation/user_menu_component.rb', line 29

def button_classes
  "#{BASE_CLASSES} #{active? ? EXPANDED_BUTTON_CLASSES : INACTIVE_CLASSES}"
end