88 * SPDX-License-Identifier: EPL-2.0
99 ********************************************************************************/
1010
11- import React , { FunctionComponent , PropsWithChildren } from 'react' ;
12- import { Theme , Typography , MenuItem , Link , Button } from '@mui/material' ;
11+ import React , { FunctionComponent , PropsWithChildren , useState , useRef } from 'react' ;
12+ import { Theme , Typography , Menu , MenuItem , Link , Button , Accordion , AccordionDetails , AccordionSummary } from '@mui/material' ;
1313import { styled } from '@mui/material/styles' ;
1414import { Link as RouteLink } from 'react-router-dom' ;
15+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore' ;
1516import GitHubIcon from '@mui/icons-material/GitHub' ;
1617import MenuBookIcon from '@mui/icons-material/MenuBook' ;
17- import HelpIcon from '@mui/icons-material/Help' ;
18- import ForumIcon from '@mui/icons-material/Forum' ;
1918import InfoIcon from '@mui/icons-material/Info' ;
2019import StarIcon from '@mui/icons-material/Star' ;
2120import StatusIcon from '@mui/icons-material/NetworkCheck' ;
2221import PublishIcon from '@mui/icons-material/Publish' ;
22+ import GroupWorkIcon from '@mui/icons-material/GroupWork' ;
23+ import PeopleAltIcon from '@mui/icons-material/PeopleAlt' ;
24+ import HubIcon from '@mui/icons-material/Hub' ;
2325import { UserSettingsRoutes } from 'openvsx-webui' ;
2426
2527//-------------------- Mobile View --------------------//
@@ -71,19 +73,41 @@ export const MobileMenuContent: FunctionComponent = () => {
7173 </ MobileMenuItemText >
7274 </ Link >
7375 </ MobileMenuItem >
74- < MobileMenuItem >
75- < Link href = 'https://www.eclipse.org/legal/open-vsx-registry-faq/' >
76+ < Accordion sx = { { border : 0 , borderRadius : 0 , boxShadow : '0 0' } } >
77+ < AccordionSummary
78+ expandIcon = { < ExpandMoreIcon /> }
79+ aria-controls = "working-group-content"
80+ id = "working-group-header"
81+ >
7682 < MobileMenuItemText >
77- < HelpIcon sx = { itemIcon } />
78- FAQ
83+ < GroupWorkIcon sx = { itemIcon } />
84+ Working Group
7985 </ MobileMenuItemText >
80- </ Link >
81- </ MobileMenuItem >
86+ </ AccordionSummary >
87+ < AccordionDetails >
88+ < MobileMenuItem >
89+ < RouteLink to = '/members' >
90+ < MobileMenuItemText >
91+ < PeopleAltIcon sx = { itemIcon } />
92+ Members
93+ </ MobileMenuItemText >
94+ </ RouteLink >
95+ </ MobileMenuItem >
96+ < MobileMenuItem >
97+ < RouteLink to = '/adopters' >
98+ < MobileMenuItemText >
99+ < HubIcon sx = { itemIcon } />
100+ Adopters
101+ </ MobileMenuItemText >
102+ </ RouteLink >
103+ </ MobileMenuItem >
104+ </ AccordionDetails >
105+ </ Accordion >
82106 < MobileMenuItem >
83- < Link href = 'https://gitter.im/ eclipse/ openvsx' >
107+ < Link href = 'https://www. eclipse.org/donate/ openvsx/ ' >
84108 < MobileMenuItemText >
85- < ForumIcon sx = { itemIcon } />
86- Community
109+ < StarIcon sx = { itemIcon } />
110+ Sponsor
87111 </ MobileMenuItemText >
88112 </ Link >
89113 </ MobileMenuItem >
@@ -95,14 +119,6 @@ export const MobileMenuContent: FunctionComponent = () => {
95119 </ MobileMenuItemText >
96120 </ RouteLink >
97121 </ MobileMenuItem >
98- < MobileMenuItem >
99- < Link href = 'https://www.eclipse.org/donate/openvsx/' >
100- < MobileMenuItemText >
101- < StarIcon sx = { itemIcon } />
102- Sponsor
103- </ MobileMenuItemText >
104- </ Link >
105- </ MobileMenuItem >
106122 {
107123 ! location . pathname . startsWith ( UserSettingsRoutes . ROOT )
108124 ? < MobileMenuItem >
@@ -135,29 +151,62 @@ const headerItem = ({ theme }: { theme: Theme }) => ({
135151 }
136152} ) ;
137153
154+ const headerTypography = ( { theme } : { theme : Theme } ) => ( {
155+ ...headerItem ( { theme} ) ,
156+ cursor : 'pointer'
157+ } ) ;
158+
138159const MenuLink = styled ( Link ) ( headerItem ) ;
139160const MenuRouteLink = styled ( RouteLink ) ( headerItem ) ;
161+ const MenuTypography = styled ( Typography ) ( headerTypography ) ;
162+
163+ const subMenuItem = ( { theme } : { theme : Theme } ) => ( {
164+ '&:focus, &:hover' : {
165+ background : 'transparent'
166+ }
167+ } ) ;
168+
169+ const subMenuLink = ( { theme } : { theme : Theme } ) => ( {
170+ ...headerItem ( { theme} ) ,
171+ margin : theme . spacing ( 0.5 )
172+ } ) ;
173+
174+ const SubMenuItem = styled ( MenuItem ) ( subMenuItem ) ;
175+ const SubMenuLink = styled ( Link ) ( subMenuLink ) ;
176+
140177
141178export const DefaultMenuContent : FunctionComponent = ( ) => {
179+ const [ workingGroupMenuOpen , setWorkingGroupOpen ] = useState ( false ) ;
180+ const workingGroupMenuEl = useRef < HTMLButtonElement | null > ( null ) ;
181+ const toggleWorkingGroupMenu = ( ) => setWorkingGroupOpen ( ! workingGroupMenuOpen ) ;
182+ const closeWorkingGroupMenu = ( ) => setWorkingGroupOpen ( false ) ;
183+
142184 return < >
143185 < MenuLink href = 'https://github.com/eclipse/openvsx/wiki' >
144186 Documentation
145187 </ MenuLink >
146- < MenuLink href = 'https://www.eclipse.org/legal/open-vsx-registry-faq/' >
147- FAQ
148- </ MenuLink >
149188 < MenuLink href = 'https://status.open-vsx.org/' >
150189 Status
151190 </ MenuLink >
152- < MenuLink href = 'https://gitter.im/eclipse/openvsx' >
153- Community
191+ < MenuTypography onClick = { toggleWorkingGroupMenu } ref = { workingGroupMenuEl } > Working Group</ MenuTypography >
192+ < Menu open = { workingGroupMenuOpen } onClose = { closeWorkingGroupMenu } anchorEl = { workingGroupMenuEl . current } >
193+ < SubMenuItem >
194+ < SubMenuLink href = '/members' onClick = { closeWorkingGroupMenu } >
195+ Members
196+ </ SubMenuLink >
197+ </ SubMenuItem >
198+ < SubMenuItem >
199+ < SubMenuLink href = '/adopters' onClick = { closeWorkingGroupMenu } >
200+ Adopters
201+ </ SubMenuLink >
202+ </ SubMenuItem >
203+ </ Menu >
204+ < MenuLink href = 'https://www.eclipse.org/donate/openvsx/' >
205+ Sponsor
154206 </ MenuLink >
155207 < MenuRouteLink to = '/about' >
156208 About
157209 </ MenuRouteLink >
158- < MenuLink href = 'https://www.eclipse.org/donate/openvsx/' >
159- Sponsor
160- </ MenuLink >
161210 < Button variant = 'contained' color = 'secondary' href = '/user-settings/extensions' sx = { { mx : 2.5 } } >
162211 Publish
163212 </ Button >
0 commit comments