@@ -25,11 +25,11 @@ import { WorkspaceLogo } from "../logo";
2525import SidebarDropdownItem from "./dropdown-item" ;
2626
2727type WorkspaceMenuRootProps = {
28- renderLogoOnly ?: boolean ;
28+ variant : "sidebar" | "top-navigation" ;
2929} ;
3030
3131export const WorkspaceMenuRoot = observer ( function WorkspaceMenuRoot ( props : WorkspaceMenuRootProps ) {
32- const { renderLogoOnly } = props ;
32+ const { variant } = props ;
3333 // store hooks
3434 const { toggleSidebar, toggleAnySidebarDropdown } = useAppTheme ( ) ;
3535 const { data : currentUser } = useUser ( ) ;
@@ -72,8 +72,8 @@ export const WorkspaceMenuRoot = observer(function WorkspaceMenuRoot(props: Work
7272 < Menu
7373 as = "div"
7474 className = { cn ( "relative h-full flex max-w-48 w-fit whitespace-nowrap truncate" , {
75- "justify-center text-center" : renderLogoOnly ,
76- "flex-grow justify-stretch text-left truncate" : ! renderLogoOnly ,
75+ "w-full justify-center text-center" : variant === "sidebar" ,
76+ "flex-grow justify-stretch text-left truncate" : variant === "top-navigation" ,
7777 } ) }
7878 >
7979 { ( { open, close } : { open : boolean ; close : ( ) => void } ) => {
@@ -84,9 +84,9 @@ export const WorkspaceMenuRoot = observer(function WorkspaceMenuRoot(props: Work
8484
8585 return (
8686 < >
87- { renderLogoOnly ? (
87+ { variant === "sidebar" && (
8888 < Menu . Button
89- className = { cn ( "flex items-center justify-center size-8 rounded" , {
89+ className = { cn ( "flex w-full items-center justify-center size-8 rounded-md " , {
9090 "bg-custom-sidebar-background-80" : open ,
9191 } ) }
9292 >
@@ -97,26 +97,29 @@ export const WorkspaceMenuRoot = observer(function WorkspaceMenuRoot(props: Work
9797 < WorkspaceLogo
9898 logo = { activeWorkspace ?. logo_url }
9999 name = { activeWorkspace ?. name }
100- classNames = "size-8 rounded-md"
100+ classNames = "size-8 rounded-md border border-custom-border-200 "
101101 />
102102 ) ,
103103 } }
104104 />
105105 </ Menu . Button >
106- ) : (
106+ ) }
107+ { variant === "top-navigation" && (
107108 < Menu . Button
108109 className = { cn (
109- "group/menu-button flex items-center gap-1 p-1 truncate rounded text-sm font-medium text-custom-sidebar-text-200 hover:bg-custom-sidebar-background-80 focus:outline-none " ,
110+ "group/menu-button flex items-center gap-1 p-1 truncate rounded text-sm font-medium text-custom-sidebar-text-200 hover:bg-custom-sidebar-background-80 focus:outline-none justify-between flex-grow " ,
110111 {
111- "justify-center text-center" : renderLogoOnly ,
112- "justify-between flex-grow" : ! renderLogoOnly ,
113112 "bg-custom-sidebar-background-80" : open ,
114113 }
115114 ) }
116115 aria-label = { t ( "aria_labels.projects_sidebar.open_workspace_switcher" ) }
117116 >
118117 < div className = "flex-grow flex items-center gap-2 truncate" >
119- < WorkspaceLogo logo = { activeWorkspace ?. logo_url } name = { activeWorkspace ?. name } />
118+ < WorkspaceLogo
119+ logo = { activeWorkspace ?. logo_url }
120+ name = { activeWorkspace ?. name }
121+ classNames = "border border-custom-border-200 size-7"
122+ />
120123 < h4 className = "truncate text-base font-medium text-custom-text-100" >
121124 { activeWorkspace ?. name ?? t ( "loading" ) }
122125 </ h4 >
@@ -128,7 +131,6 @@ export const WorkspaceMenuRoot = observer(function WorkspaceMenuRoot(props: Work
128131 />
129132 </ Menu . Button >
130133 ) }
131-
132134 < Transition
133135 as = { Fragment }
134136 enter = "transition ease-out duration-100"
@@ -139,7 +141,15 @@ export const WorkspaceMenuRoot = observer(function WorkspaceMenuRoot(props: Work
139141 leaveTo = "transform opacity-0 scale-95"
140142 >
141143 < Menu . Items as = { Fragment } >
142- < div className = "fixed top-10 left-4 z-[21] mt-1 flex w-[19rem] origin-top-left flex-col divide-y divide-custom-border-100 rounded-md border-[0.5px] border-custom-sidebar-border-300 bg-custom-sidebar-background-100 shadow-custom-shadow-rg outline-none" >
144+ < div
145+ className = { cn (
146+ "fixed z-[21] mt-1 flex w-[19rem] origin-top-left flex-col divide-y divide-custom-border-100 rounded-md border-[0.5px] border-custom-sidebar-border-300 bg-custom-sidebar-background-100 shadow-custom-shadow-rg outline-none" ,
147+ {
148+ "top-11 left-14" : variant === "sidebar" ,
149+ "top-10 left-4" : variant === "top-navigation" ,
150+ }
151+ ) }
152+ >
143153 < div className = "overflow-x-hidden vertical-scrollbar scrollbar-sm flex max-h-96 flex-col items-start justify-start overflow-y-scroll" >
144154 < span className = "rounded-md text-left px-4 sticky top-0 z-[21] h-full w-full bg-custom-sidebar-background-100 pb-1 pt-3 text-sm font-medium text-custom-text-400 truncate flex-shrink-0" >
145155 { currentUser ?. email }
0 commit comments