@@ -7,10 +7,7 @@ import {
77} from 'react' ;
88import { writeSidebarCollapsed } from '../lib/storage' ;
99import type { ThemePreference , TocItem } from '../lib/types' ;
10- import {
11- getActiveTocIndex ,
12- identifyPrintBlock ,
13- } from '../host/toc' ;
10+ import { getActiveTocIndex , identifyPrintBlock } from '../host/toc' ;
1411import { Sidebar } from './sidebar/Sidebar' ;
1512
1613type AppProps = {
@@ -19,14 +16,9 @@ type AppProps = {
1916 initialTheme : ThemePreference ;
2017} ;
2118
22- type SidebarPhase =
23- | 'closed'
24- | 'opening'
25- | 'open'
26- | 'closing-ready'
27- | 'closing' ;
19+ type SidebarPhase = 'closed' | 'opening' | 'open' | 'closing-ready' | 'closing' ;
2820
29- const SIDEBAR_TRANSITION_MS = 150 ;
21+ const SIDEBAR_TRANSITION_MS = 200 ;
3022const SIDEBAR_TRANSITION_FALLBACK_MS = SIDEBAR_TRANSITION_MS + 100 ;
3123
3224function syncSidebarPhase ( phase : SidebarPhase ) : void {
@@ -38,18 +30,14 @@ function prefersReducedMotion(): boolean {
3830 return window . matchMedia ( '(prefers-reduced-motion: reduce)' ) . matches ;
3931}
4032
41- export function App ( {
42- items,
43- initialCollapsed,
44- initialTheme,
45- } : AppProps ) {
33+ export function App ( { items, initialCollapsed, initialTheme } : AppProps ) {
4634 const [ sidebarPhase , setSidebarPhase ] = useState < SidebarPhase > (
47- initialCollapsed ? 'closed' : 'open'
35+ initialCollapsed ? 'closed' : 'open' ,
4836 ) ;
4937 const [ paletteOpen , setPaletteOpen ] = useState ( false ) ;
5038 const [ activeIndex , setActiveIndex ] = useState ( 0 ) ;
5139 const [ dark , setDark ] = useState ( ( ) =>
52- document . body . classList . contains ( 'dark' )
40+ document . body . classList . contains ( 'dark' ) ,
5341 ) ;
5442 const prepareFrameRef = useRef < number | null > ( null ) ;
5543 const startFrameRef = useRef < number | null > ( null ) ;
@@ -67,7 +55,7 @@ export function App({
6755 window . cancelAnimationFrame ( startFrameRef . current ) ;
6856 }
6957 } ,
70- [ ]
58+ [ ] ,
7159 ) ;
7260
7361 useEffect ( ( ) => {
@@ -94,10 +82,7 @@ export function App({
9482 }
9583
9684 container ?. addEventListener ( 'transitionend' , onTransitionEnd ) ;
97- const fallback = window . setTimeout (
98- finish ,
99- SIDEBAR_TRANSITION_FALLBACK_MS
100- ) ;
85+ const fallback = window . setTimeout ( finish , SIDEBAR_TRANSITION_FALLBACK_MS ) ;
10186 return ( ) => {
10287 container ?. removeEventListener ( 'transitionend' , onTransitionEnd ) ;
10388 window . clearTimeout ( fallback ) ;
@@ -203,7 +188,11 @@ export function App({
203188 } , [ paletteOpen ] ) ;
204189
205190 return (
206- < div className = { [ 'sep-plus-app' , dark ? 'is-dark' : '' ] . filter ( Boolean ) . join ( ' ' ) } >
191+ < div
192+ className = { [ 'sep-plus-app' , dark ? 'is-dark' : '' ]
193+ . filter ( Boolean )
194+ . join ( ' ' ) }
195+ >
207196 < Sidebar
208197 items = { items }
209198 activeIndex = { activeIndex }
0 commit comments