overleaf/services/web/frontend/js/features/ide-react/hooks/use-outline-pane.ts
Alf Eaton 5c6b8ec015 Use the expanded size from localStorage when available (#16298)
GitOrigin-RevId: 7747881b99d23ebb0ee38d044c671bffb7504302
2023-12-21 09:02:56 +00:00

14 lines
588 B
TypeScript

import { useOutlineContext } from '@/features/ide-react/context/outline-context'
import useCollapsiblePanel from '@/features/ide-react/hooks/use-collapsible-panel'
import { useRef } from 'react'
import { ImperativePanelHandle } from 'react-resizable-panels'
export const useOutlinePane = () => {
const { canShowOutline, outlineExpanded } = useOutlineContext()
const outlinePanelRef = useRef<ImperativePanelHandle>(null)
const outlineEnabled = canShowOutline && outlineExpanded
useCollapsiblePanel(outlineEnabled, outlinePanelRef)
return { outlineEnabled, outlinePanelRef }
}