mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
ea1fc5f74e
* React IDE page shell * Set the maximum height of the symbol palette to 336px * Tidy export * Remove unnecessary destructuring * Update comment * Optimize toggle Co-authored-by: Alf Eaton <alf.eaton@overleaf.com> * Change snap-to-collapse threshold to 5% * Synchronize left column width between history and editor views and remove duplication in ide-page * Replace resizer dots with SVG * Rermove unnecessary import and comment the remaining ones * Use block prepend to avoid duplication * Improve vertical content divider styling * Implement fixed width during container resize on left column * Change IDE page file extension * Refactor fixed-size panel into a hook and use for chat panel --------- Co-authored-by: Alf Eaton <alf.eaton@overleaf.com> GitOrigin-RevId: aa881e48a2838a192b6f8f9e16e561f5cd706bd3
19 lines
437 B
TypeScript
19 lines
437 B
TypeScript
import { RefObject, useEffect } from 'react'
|
|
import { ImperativePanelHandle } from 'react-resizable-panels'
|
|
|
|
export default function useCollapsiblePanel(
|
|
panelIsOpen: boolean,
|
|
panelRef: RefObject<ImperativePanelHandle>
|
|
) {
|
|
useEffect(() => {
|
|
const panel = panelRef.current
|
|
if (!panel) {
|
|
return
|
|
}
|
|
if (panelIsOpen) {
|
|
panel.expand()
|
|
} else {
|
|
panel.collapse()
|
|
}
|
|
}, [panelIsOpen, panelRef])
|
|
}
|