Class: Panda::Core::Admin::Navigation::UserMenuComponent
- Inherits:
-
Base
- Object
- ViewComponent::Base
- Base
- Panda::Core::Admin::Navigation::UserMenuComponent
- 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
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #button_classes ⇒ Object
-
#initialize(user:, active: false, **attrs) ⇒ UserMenuComponent
constructor
A new instance of UserMenuComponent.
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
#user ⇒ Object (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
25 26 27 |
# File 'app/components/panda/core/admin/navigation/user_menu_component.rb', line 25 def active? @active end |
#button_classes ⇒ Object
29 30 31 |
# File 'app/components/panda/core/admin/navigation/user_menu_component.rb', line 29 def "#{BASE_CLASSES} #{active? ? EXPANDED_BUTTON_CLASSES : INACTIVE_CLASSES}" end |