2023-10-26 04:57:00 -04:00
|
|
|
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'
|
2023-11-02 07:36:04 -04:00
|
|
|
import {
|
|
|
|
FileTreeDeleteHandler,
|
|
|
|
FileTreeSelectHandler,
|
|
|
|
} from '@/features/ide-react/types/file-tree'
|
2023-11-03 08:15:36 -04:00
|
|
|
import classNames from 'classnames'
|
2023-10-26 04:57:00 -04:00
|
|
|
|
|
|
|
type EditorSidebarProps = {
|
2023-12-05 04:34:21 -05:00
|
|
|
shouldShow?: boolean
|
2023-10-26 04:57:00 -04:00
|
|
|
onFileTreeInit: () => void
|
|
|
|
onFileTreeSelect: FileTreeSelectHandler
|
2023-11-02 07:36:04 -04:00
|
|
|
onFileTreeDelete: FileTreeDeleteHandler
|
2023-10-26 04:57:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export default function EditorSidebar({
|
2023-12-05 04:34:21 -05:00
|
|
|
shouldShow = false,
|
2023-10-26 04:57:00 -04:00
|
|
|
onFileTreeInit,
|
|
|
|
onFileTreeSelect,
|
2023-11-02 07:36:04 -04:00
|
|
|
onFileTreeDelete,
|
2023-10-26 04:57:00 -04:00
|
|
|
}: EditorSidebarProps) {
|
|
|
|
return (
|
2023-12-05 04:34:21 -05:00
|
|
|
<aside
|
|
|
|
className={classNames('ide-react-editor-sidebar', {
|
|
|
|
hidden: !shouldShow,
|
|
|
|
})}
|
|
|
|
>
|
2023-12-05 05:19:00 -05:00
|
|
|
<PanelGroup autoSaveId="ide-editor-sidebar-layout" direction="vertical">
|
|
|
|
<Panel
|
|
|
|
defaultSizePercentage={75}
|
|
|
|
className="ide-react-file-tree-panel"
|
|
|
|
id="panel-file-tree"
|
|
|
|
>
|
2023-12-05 04:34:21 -05:00
|
|
|
<FileTree
|
|
|
|
onInit={onFileTreeInit}
|
|
|
|
onSelect={onFileTreeSelect}
|
|
|
|
onDelete={onFileTreeDelete}
|
|
|
|
/>
|
|
|
|
</Panel>
|
|
|
|
<VerticalResizeHandle />
|
2023-12-05 05:19:00 -05:00
|
|
|
<Panel defaultSizePercentage={25} id="panel-outline">
|
2023-12-05 04:34:21 -05:00
|
|
|
<div className="outline-container" />
|
|
|
|
</Panel>
|
|
|
|
</PanelGroup>
|
|
|
|
</aside>
|
2023-10-26 04:57:00 -04:00
|
|
|
)
|
|
|
|
}
|