mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
a4b9947fe4
React IDE page: implement file restore and simplify some state GitOrigin-RevId: ff63eb4f649156b58d9f8c4573cb6bd5b516a299
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import React from 'react'
|
|
import { Panel, PanelGroup } from 'react-resizable-panels'
|
|
import { VerticalResizeHandle } from '@/features/ide-react/components/resize/vertical-resize-handle'
|
|
import { FileTree } from '@/features/ide-react/components/file-tree'
|
|
import {
|
|
FileTreeDeleteHandler,
|
|
FileTreeSelectHandler,
|
|
} from '@/features/ide-react/types/file-tree'
|
|
import classNames from 'classnames'
|
|
|
|
type EditorSidebarProps = {
|
|
shouldShow: boolean
|
|
shouldPersistLayout: boolean
|
|
onFileTreeInit: () => void
|
|
onFileTreeSelect: FileTreeSelectHandler
|
|
onFileTreeDelete: FileTreeDeleteHandler
|
|
}
|
|
|
|
export default function EditorSidebar({
|
|
shouldShow,
|
|
shouldPersistLayout,
|
|
onFileTreeInit,
|
|
onFileTreeSelect,
|
|
onFileTreeDelete,
|
|
}: EditorSidebarProps) {
|
|
return (
|
|
<>
|
|
<aside
|
|
className={classNames('ide-react-editor-sidebar', {
|
|
hidden: !shouldShow,
|
|
})}
|
|
>
|
|
<PanelGroup
|
|
autoSaveId={
|
|
shouldPersistLayout ? 'ide-react-editor-sidebar-layout' : undefined
|
|
}
|
|
direction="vertical"
|
|
>
|
|
<Panel defaultSize={75} className="ide-react-file-tree-panel">
|
|
<FileTree
|
|
onInit={onFileTreeInit}
|
|
onSelect={onFileTreeSelect}
|
|
onDelete={onFileTreeDelete}
|
|
/>
|
|
</Panel>
|
|
<VerticalResizeHandle />
|
|
<Panel defaultSize={25}>
|
|
<div className="outline-container" />
|
|
</Panel>
|
|
</PanelGroup>
|
|
</aside>
|
|
</>
|
|
)
|
|
}
|