@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
22import { useHistory } from '@docusaurus/router' ;
33import { useActiveDocContext } from '@docusaurus/plugin-content-docs/client' ;
44import { isMobileSdkDocument , getCorrespondingDocId } from '../../lib/sidebarMapping' ;
5+ import styles from './styles.module.css' ;
56
67
78
@@ -132,56 +133,20 @@ export default function SidebarMenu() {
132133
133134
134135 return (
135- < div style = { {
136- width : '100%' ,
137- padding : '24px 16px 8px 16px' ,
138- background : '#f8f9fa' ,
139- borderBottom : '1px solid #e9ecef' ,
140- flexShrink : 0 ,
141- boxShadow : '0 1px 3px rgba(0,0,0,0.1)'
142- } } >
143- < div style = { {
144- display : 'flex' ,
145- alignItems : 'center' ,
146- gap : '8px'
147- } } >
148- < div style = { {
149- color : '#495057' ,
150- fontWeight : '600' ,
151- fontSize : '15px' ,
152- whiteSpace : 'nowrap'
153- } } >
136+ < div className = { styles . platformSwitcher } >
137+ < div className = { styles . switcherInner } >
138+ < div className = { styles . switcherLabel } >
154139 Platform:
155140 </ div >
156- < div style = { { position : 'relative' , flex : 1 } } >
141+ < div className = { styles . selectWrapper } >
157142 < button
158- style = { {
159- width : '100%' ,
160- background : 'white' ,
161- border : '1px solid #dee2e6' ,
162- borderRadius : '8px' ,
163- color : '#495057' ,
164- fontSize : '15px' ,
165- fontWeight : '500' ,
166- padding : '8px 12px' ,
167- cursor : 'pointer' ,
168- display : 'flex' ,
169- alignItems : 'center' ,
170- justifyContent : 'space-between' ,
171- minWidth : '0'
172- } }
143+ className = { styles . selectButton }
173144 onClick = { ( ) => setIsDropdownOpen ( ! isDropdownOpen ) }
174145 onBlur = { ( ) => setTimeout ( ( ) => setIsDropdownOpen ( false ) , 150 ) }
175146 >
176147 < span > { currentPlatform . name } </ span >
177148 < svg
178- style = { {
179- width : '12px' ,
180- height : '12px' ,
181- marginLeft : '8px' ,
182- transform : isDropdownOpen ? 'rotate(180deg)' : 'rotate(0deg)' ,
183- transition : 'transform 0.2s ease'
184- } }
149+ className = { `${ styles . selectIcon } ${ isDropdownOpen ? styles . selectIconOpen : '' } ` }
185150 fill = "currentColor"
186151 viewBox = "0 0 20 20"
187152 >
@@ -190,54 +155,15 @@ export default function SidebarMenu() {
190155 </ button >
191156
192157 { isDropdownOpen && (
193- < div style = { {
194- position : 'absolute' ,
195- top : '100%' ,
196- left : '0' ,
197- right : '0' ,
198- background : 'white' ,
199- border : '1px solid #dee2e6' ,
200- borderRadius : '8px' ,
201- boxShadow : '0 4px 6px rgba(0, 0, 0, 0.1)' ,
202- zIndex : 1000 ,
203- marginTop : '2px' ,
204- padding : '8px'
205- } } >
158+ < div className = { styles . dropdown } >
206159 { platforms . map ( ( platform ) => (
207160 < button
208161 key = { platform . name }
209- style = { {
210- width : '100%' ,
211- padding : '6px 16px' ,
212- background : platform . name === currentPlatform . name ? 'var(--ifm-menu-color-background-active)' : 'transparent' ,
213- border : 'none' ,
214- textAlign : 'left' ,
215- cursor : 'pointer' ,
216- fontSize : '15px' ,
217- color : platform . name === currentPlatform . name ? 'var(--purplePrimary)' : 'var(--textSecondary)' ,
218- fontWeight : platform . name === currentPlatform . name ? '600' : '400' ,
219- borderRadius : '8px' ,
220- margin : '0'
221- } }
162+ className = { `${ styles . dropdownItem } ${ platform . name === currentPlatform . name ? styles . dropdownItemActive : '' } ` }
222163 onClick = { ( ) => {
223164 handlePlatformChange ( platform ) ;
224165 setIsDropdownOpen ( false ) ;
225166 } }
226- onMouseEnter = { ( e ) => {
227- if ( platform . name !== currentPlatform . name ) {
228- e . target . style . background = 'var(--ifm-menu-color-background-hover)' ;
229- e . target . style . color = 'var(--textPrimary)' ;
230- }
231- } }
232- onMouseLeave = { ( e ) => {
233- if ( platform . name !== currentPlatform . name ) {
234- e . target . style . background = 'transparent' ;
235- e . target . style . color = 'var(--textSecondary)' ;
236- } else {
237- e . target . style . background = 'var(--ifm-menu-color-background-active)' ;
238- e . target . style . color = 'var(--purplePrimary)' ;
239- }
240- } }
241167 >
242168 { platform . name }
243169 </ button >
0 commit comments