@@ -85,64 +85,66 @@ const NavBar = () => {
85
85
} }
86
86
>
87
87
< Stack sx = { { paddingTop : 4 , paddingRight : 4 } } >
88
- { ! isDesktopDevice && < NavItems user = { user } t = { t } languages = { languages } handleLanguageChange = { handleLanguageChange } language = { language } /> }
88
+ { ! isDesktopDevice && < NavItems user = { user } t = { t } languages = { languages } handleLanguageChange = { handleLanguageChange } language = { language } vertical /> }
89
89
</ Stack >
90
90
</ Drawer >
91
91
</ >
92
92
)
93
93
}
94
- const NavItemButton = ( { children, to, path, current, icon } ) => (
95
- < Button
96
- component = { Link }
97
- to = { to }
98
- size = "small"
99
- variant = "text"
100
- startIcon = { icon }
101
- sx = { {
102
- borderBottom : '2px solid' ,
103
- borderBottomLeftRadius : '0' ,
104
- borderBottomRightRadius : '0' ,
105
- borderBottomColor : matchPath ( { path : path } , current ) ? 'primary.main' : 'transparent' ,
106
- } }
107
- >
108
- { children }
109
- </ Button >
110
- )
94
+ const NavItemButton = ( { children, to, path, current, icon, vertical } ) => {
95
+ const borderSide = vertical ? 'Left' : 'Bottom'
96
+ return (
97
+ < Button
98
+ component = { Link }
99
+ to = { to }
100
+ size = "small"
101
+ variant = "text"
102
+ startIcon = { icon }
103
+ sx = { {
104
+ [ `border${ borderSide } ` ] : '2px solid' ,
105
+ borderRadius : '0' ,
106
+ [ `border${ borderSide } Color` ] : matchPath ( { path : path } , current ) ? 'primary.main' : 'transparent' ,
107
+ } }
108
+ >
109
+ { children }
110
+ </ Button >
111
+ )
112
+ }
111
113
112
- const NavItems = ( { user, t, languages, handleLanguageChange, language } ) => {
114
+ const NavItems = ( { user, t, languages, handleLanguageChange, language, vertical = false } ) => {
113
115
const anchorRef = useRef < HTMLButtonElement > ( null )
114
116
const { pathname } = useLocation ( )
115
117
const [ openLanguageSelect , setOpenLanguageSelect ] = useState ( false )
116
118
117
119
return (
118
120
< >
119
121
{ user ?. preferences ?. chatVersion !== 2 && (
120
- < NavItemButton to = "/v2" path = "v2/*" current = { pathname } icon = { < GradeOutlined sx = { styles . icon } /> } >
122
+ < NavItemButton to = "/v2" path = "v2/*" current = { pathname } icon = { < GradeOutlined sx = { styles . icon } /> } vertical = { vertical } >
121
123
{ t ( 'tryNew' ) }
122
124
</ NavItemButton >
123
125
) }
124
126
{ user ?. preferences ?. chatVersion !== 1 && (
125
- < NavItemButton to = "/v1" path = "v1/*" current = { pathname } icon = { < GradeOutlined sx = { styles . icon } /> } >
127
+ < NavItemButton to = "/v1" path = "v1/*" current = { pathname } icon = { < GradeOutlined sx = { styles . icon } /> } vertical = { vertical } >
126
128
{ t ( 'useOld' ) }
127
129
</ NavItemButton >
128
130
) }
129
131
{ user . enrolledCourses . length > 0 && (
130
- < NavItemButton to = "/chats" path = "chats/*" current = { pathname } icon = { < BookmarksOutlined sx = { styles . icon } /> } >
132
+ < NavItemButton to = "/chats" path = "chats/*" current = { pathname } icon = { < BookmarksOutlined sx = { styles . icon } /> } vertical = { vertical } >
131
133
{ t ( 'chats' ) }
132
134
</ NavItemButton >
133
135
) }
134
136
{ user . ownCourses . length > 0 && (
135
- < NavItemButton to = "/courses" path = "courses/*" current = { pathname } icon = { < BookmarksOutlined sx = { styles . icon } /> } >
137
+ < NavItemButton to = "/courses" path = "courses/*" current = { pathname } icon = { < BookmarksOutlined sx = { styles . icon } /> } vertical = { vertical } >
136
138
{ t ( 'courses' ) }
137
139
</ NavItemButton >
138
140
) }
139
141
{ user . isStatsViewer && (
140
- < NavItemButton to = "/statistics" path = "statistics/*" current = { pathname } icon = { < AdminPanelSettingsOutlined sx = { styles . icon } /> } >
142
+ < NavItemButton to = "/statistics" path = "statistics/*" current = { pathname } icon = { < AdminPanelSettingsOutlined sx = { styles . icon } /> } vertical = { vertical } >
141
143
{ t ( 'courseStats' ) }
142
144
</ NavItemButton >
143
145
) }
144
146
{ user . isAdmin && (
145
- < NavItemButton to = "/admin" path = "admin/*" current = { pathname } icon = { < AdminPanelSettingsOutlined sx = { styles . icon } /> } >
147
+ < NavItemButton to = "/admin" path = "admin/*" current = { pathname } icon = { < AdminPanelSettingsOutlined sx = { styles . icon } /> } vertical = { vertical } >
146
148
{ t ( 'admin' ) }
147
149
</ NavItemButton >
148
150
) }
0 commit comments