|
1 | | -import { SidebarIcon } from '@phosphor-icons/react'; |
| 1 | +import { SidebarSimpleIcon } from '@phosphor-icons/react'; |
2 | 2 | import { SuiteLauncher } from '../suiteLauncher'; |
3 | 3 |
|
4 | 4 | interface SidenavHeaderProps { |
@@ -32,52 +32,46 @@ const SidenavHeader = ({ |
32 | 32 | suiteLauncher, |
33 | 33 | }: SidenavHeaderProps): JSX.Element => { |
34 | 34 | return ( |
35 | | - <div |
36 | | - className={`flex flex-row justify-between w-full py-5 px-2 ${className} ${isCollapsed ? 'justify-center' : ''}`} |
37 | | - > |
38 | | - {isCollapsed ? ( |
39 | | - <div className="relative flex items-center justify-center w-full"> |
40 | | - <button className="flex flex-row gap-2 items-center" onClick={onClick}> |
41 | | - <img src={logo} width={28} alt={title} className="group-hover:hidden" /> |
42 | | - {onToggleCollapse && ( |
43 | | - <button |
44 | | - onClick={(e) => { |
45 | | - e.stopPropagation(); |
46 | | - onToggleCollapse(); |
47 | | - }} |
48 | | - className="hidden group-hover:flex items-center justify-center text-gray-80" |
49 | | - > |
50 | | - <SidebarIcon size={28} /> |
51 | | - </button> |
52 | | - )} |
| 35 | + <div className={`flex flex-row justify-between w-full py-5 px-2 ${className}`}> |
| 36 | + <div className="relative flex flex-row gap-2 items-center"> |
| 37 | + <button className="flex flex-row gap-2 items-center" onClick={onClick}> |
| 38 | + <img |
| 39 | + src={logo} |
| 40 | + width={28} |
| 41 | + alt={title} |
| 42 | + className={`flex-shrink-0 ${isCollapsed ? 'group-hover:hidden' : ''}`} |
| 43 | + /> |
| 44 | + {!isCollapsed && <p className="text-xl font-medium text-gray-100 whitespace-nowrap">{title}</p>} |
| 45 | + </button> |
| 46 | + {isCollapsed && onToggleCollapse && ( |
| 47 | + <button |
| 48 | + onClick={onToggleCollapse} |
| 49 | + className="hidden group-hover:flex items-center justify-center text-gray-80 absolute left-0" |
| 50 | + > |
| 51 | + <SidebarSimpleIcon size={28} /> |
53 | 52 | </button> |
54 | | - </div> |
55 | | - ) : ( |
56 | | - <> |
57 | | - <button className="flex flex-row gap-2 items-center" onClick={onClick}> |
58 | | - <img src={logo} width={28} alt={title} /> |
59 | | - <p className="text-xl font-medium text-gray-100">{title}</p> |
| 53 | + )} |
| 54 | + </div> |
| 55 | + <div |
| 56 | + className={`flex z-20 flex-row gap-2 items-center transition-opacity duration-100 ${isCollapsed ? 'opacity-0 invisible' : 'opacity-100'}`} |
| 57 | + > |
| 58 | + {suiteLauncher && ( |
| 59 | + <SuiteLauncher |
| 60 | + suiteArray={suiteLauncher?.suiteArray} |
| 61 | + soonText={suiteLauncher?.soonText} |
| 62 | + className={`text-gray-80 ${suiteLauncher?.className}`} |
| 63 | + align="left" |
| 64 | + /> |
| 65 | + )} |
| 66 | + {onToggleCollapse && ( |
| 67 | + <button |
| 68 | + onClick={onToggleCollapse} |
| 69 | + className="flex items-center justify-center text-gray-80 hover:text-gray-90" |
| 70 | + > |
| 71 | + <SidebarSimpleIcon size={28} /> |
60 | 72 | </button> |
61 | | - <div className="flex flex-row gap-2 items-center"> |
62 | | - {suiteLauncher && ( |
63 | | - <SuiteLauncher |
64 | | - suiteArray={suiteLauncher?.suiteArray} |
65 | | - soonText={suiteLauncher?.soonText} |
66 | | - className={`text-gray-80 ${suiteLauncher?.className}`} |
67 | | - align="left" |
68 | | - /> |
69 | | - )} |
70 | | - {onToggleCollapse && ( |
71 | | - <button |
72 | | - onClick={onToggleCollapse} |
73 | | - className="flex items-center justify-center text-gray-80 hover:text-gray-90" |
74 | | - > |
75 | | - <SidebarIcon size={28} /> |
76 | | - </button> |
77 | | - )} |
78 | | - </div> |
79 | | - </> |
80 | | - )} |
| 73 | + )} |
| 74 | + </div> |
81 | 75 | </div> |
82 | 76 | ); |
83 | 77 | }; |
|
0 commit comments