File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,16 +32,17 @@ export const NavPanels = (props: NavPanelsProps) => {
3232 jumpToState,
3333 } = props ;
3434
35- const [ isOpen , setIsOpen ] = useState ( { main : false , jump : false } ) ;
35+ const [ isOpen , setIsOpen ] = useState ( { main : true , jump : true } ) ;
3636 const [ isMobile , setIsMobile ] = useState ( true ) ;
3737
38- // Defaults to closed on mobile, open on desktop
39- // Have to do this in a lifecycle method
40- // so that we can still server-side render
4138 useEffect ( ( ) => {
4239 const startsMobile = window . innerWidth < 768 ;
4340 setIsMobile ( startsMobile ) ;
4441 setIsOpen ( { main : ! startsMobile , jump : ! startsMobile } ) ;
42+ requestAnimationFrame ( ( ) => {
43+ document . documentElement . setAttribute ( "data-nav-panels-ready" , "true" ) ;
44+ } ) ;
45+
4546 // We use a resize observer to the user's window crosses the
4647 // threshhold between mobile and desktop
4748 const documentObserver = new ResizeObserver ( ( entries ) => {
Original file line number Diff line number Diff line change 132132.jumpto {
133133 border-color : var (--sidebar-type-color );
134134
135- animation : height 0.3 s ease-in-out ;
135+ animation : none ;
136136 flex-grow : 0 ;
137137 border-bottom-width : 1px ;
138138 height : 40px ;
262262 margin-top : 4px ;
263263}
264264
265- /* Interaction */
265+ :global(html [data-nav-panels-ready = " true" ]) .jumpto {
266+ animation : height 0.3s ease-in-out ;
267+ }
266268
267269.jumpto :global(.open ) {
268270 flex-grow : 1 ;
277279 }
278280 }
279281}
282+ @media (max-width : ($breakpoint-tablet - 1px )) {
283+ :global (html:not([data-nav-panels-ready= " true" ] )) .mainlinks :global (.open ) {
284+ height : 43px ;
285+ }
280286
287+ :global(html :not ([data-nav-panels-ready = " true" ])) .jumpto :global(.open ) {
288+ flex-grow : 0 ;
289+ height : 40px ;
290+ overflow : hidden ;
291+ }
292+ }
281293/* Page-specific modifications */
282294:global(.reference-item ) .jumpto ul {
283295 grid-template-columns : 1fr ;
286298.jumpto ul li .linklabel :not (:global(.small ), :first-child ) {
287299 margin-top : 10px ;
288300}
289-
You can’t perform that action at this time.
0 commit comments