1
1
import { cx } from "@emotion/css" ;
2
- import GeneralIcon from "@mui/icons-material/SettingsOutlined" ;
3
- import type { ElementType , FC , ReactNode } from "react" ;
4
- import { NavLink } from "react-router-dom" ;
2
+ import type { FC , ReactNode } from "react" ;
3
+ import { Link , NavLink } from "react-router-dom" ;
5
4
import type { Organization } from "api/typesGenerated" ;
6
5
import { Sidebar as BaseSidebar } from "components/Sidebar/Sidebar" ;
7
6
import { Stack } from "components/Stack/Stack" ;
8
7
import { type ClassName , useClassName } from "hooks/useClassName" ;
9
8
import { useOrganizationSettings } from "./OrganizationSettingsLayout" ;
9
+ import { UserAvatar } from "components/UserAvatar/UserAvatar" ;
10
10
11
11
export const Sidebar : FC = ( ) => {
12
12
const { currentOrganizationId, organizations } = useOrganizationSettings ( ) ;
@@ -39,8 +39,16 @@ export const OrganizationBloob: FC<BloobProps> = ({ organization, active }) => {
39
39
return (
40
40
< >
41
41
< SidebarNavItem
42
+ active = { active }
42
43
href = { urlForSubpage ( organization . name ) }
43
- icon = { GeneralIcon }
44
+ icon = {
45
+ < UserAvatar
46
+ key = { organization . id }
47
+ size = "sm"
48
+ username = { organization . display_name }
49
+ avatarURL = { organization . icon }
50
+ />
51
+ }
44
52
>
45
53
{ organization . display_name }
46
54
</ SidebarNavItem >
@@ -75,29 +83,28 @@ export const OrganizationBloob: FC<BloobProps> = ({ organization, active }) => {
75
83
} ;
76
84
77
85
interface SidebarNavItemProps {
86
+ active ?: boolean ;
78
87
children ?: ReactNode ;
79
- icon : ElementType ;
88
+ icon : ReactNode ;
80
89
href : string ;
81
90
}
82
91
83
92
export const SidebarNavItem : FC < SidebarNavItemProps > = ( {
93
+ active,
84
94
children,
85
95
href,
86
- icon : Icon ,
96
+ icon,
87
97
} ) => {
88
98
const link = useClassName ( classNames . link , [ ] ) ;
89
99
const activeLink = useClassName ( classNames . activeLink , [ ] ) ;
90
100
91
101
return (
92
- < NavLink
93
- to = { href }
94
- className = { ( { isActive } ) => cx ( [ link , isActive && activeLink ] ) }
95
- >
102
+ < Link to = { href } className = { cx ( [ link , active && activeLink ] ) } >
96
103
< Stack alignItems = "center" spacing = { 1.5 } direction = "row" >
97
- < Icon css = { { width : 16 , height : 16 } } />
104
+ { icon }
98
105
{ children }
99
106
</ Stack >
100
- </ NavLink >
107
+ </ Link >
101
108
) ;
102
109
} ;
103
110
@@ -154,7 +161,7 @@ const classNames = {
154
161
155
162
display : block;
156
163
font-size : 13px ;
157
- margin-left : 35 px ;
164
+ margin-left : 42 px ;
158
165
padding : 4px 12px ;
159
166
border-radius : 4px ;
160
167
transition : background-color 0.15s ease-in-out;
@@ -167,6 +174,6 @@ const classNames = {
167
174
` ,
168
175
169
176
activeSubLink : ( css ) => css `
170
- font-weight : 500 ;
177
+ font-weight : 600 ;
171
178
` ,
172
179
} satisfies Record < string , ClassName > ;
0 commit comments