8
8
* SPDX-License-Identifier: EPL-2.0
9
9
********************************************************************************/
10
10
11
- import React , { FunctionComponent , PropsWithChildren , useState , useRef , useContext } from 'react' ;
11
+ import React , { FunctionComponent , useState , useRef , useContext } from 'react' ;
12
12
import { Theme , Typography , Menu , MenuItem , Link , Button , Accordion , AccordionDetails , AccordionSummary , IconButton } from '@mui/material' ;
13
13
import { styled } from '@mui/material/styles' ;
14
14
import { Link as RouteLink } from 'react-router-dom' ;
@@ -25,32 +25,11 @@ import HubIcon from '@mui/icons-material/Hub';
25
25
import AccountBoxIcon from '@mui/icons-material/AccountBox' ;
26
26
import { UserSettingsRoutes } from 'openvsx-webui' ;
27
27
import { MainContext } from 'openvsx-webui/lib/context' ;
28
- import { MobileUserAvatar } from 'openvsx-webui/lib/default/menu-content'
28
+ import { MobileMenuItem , itemIcon , MobileMenuItemText , MobileUserAvatar , headerItem , MenuLink , MenuRouteLink } from 'openvsx-webui/lib/default/menu-content'
29
29
import { UserAvatar } from 'openvsx-webui/lib/pages/user/avatar' ;
30
30
31
31
//-------------------- Mobile View --------------------//
32
32
33
- const MobileMenuItem = styled ( MenuItem ) ( {
34
- cursor : 'auto' ,
35
- '&>a' : {
36
- textDecoration : 'none'
37
- }
38
- } ) ;
39
-
40
- const itemIcon = {
41
- mr : 1 ,
42
- width : '16px' ,
43
- height : '16px' ,
44
- } ;
45
-
46
- const MobileMenuItemText : FunctionComponent < PropsWithChildren > = ( { children } ) => {
47
- return (
48
- < Typography variant = 'body2' sx = { { color : 'text.primary' , display : 'flex' , alignItems : 'center' , textTransform : 'none' } } >
49
- { children }
50
- </ Typography >
51
- ) ;
52
- } ;
53
-
54
33
export const MobileMenuContent : FunctionComponent = ( ) => {
55
34
const { service, user} = useContext ( MainContext )
56
35
return < >
@@ -154,27 +133,11 @@ export const MobileMenuContent: FunctionComponent = () => {
154
133
155
134
//-------------------- Default View --------------------//
156
135
157
- const headerItem = ( { theme } : { theme : Theme } ) => ( {
158
- margin : theme . spacing ( 2.5 ) ,
159
- color : theme . palette . text . primary ,
160
- textDecoration : 'none' ,
161
- fontSize : '1.1rem' ,
162
- fontFamily : theme . typography . fontFamily ,
163
- fontWeight : theme . typography . fontWeightLight ,
164
- letterSpacing : 1 ,
165
- '&:hover' : {
166
- color : theme . palette . secondary . main ,
167
- textDecoration : 'none'
168
- }
169
- } ) ;
170
-
171
136
const headerTypography = ( { theme } : { theme : Theme } ) => ( {
172
137
...headerItem ( { theme} ) ,
173
138
cursor : 'pointer'
174
139
} ) ;
175
140
176
- const MenuLink = styled ( Link ) ( headerItem ) ;
177
- const MenuRouteLink = styled ( RouteLink ) ( headerItem ) ;
178
141
const MenuTypography = styled ( Typography ) ( headerTypography ) ;
179
142
180
143
const subMenuItem = ( { theme } : { theme : Theme } ) => ( {
0 commit comments