💄 slide-in animation for the header nav
This commit is contained in:
@@ -11,7 +11,7 @@ import './styles/app.css'
|
||||
export default function App(): JSX.Element {
|
||||
const {
|
||||
setFileTree, activeFilePath, isDirty, markSaved, activeFileContent, theme, toggleTheme,
|
||||
loadSession, revisionPanelOpen, toggleRevisionPanel, outlineOpen
|
||||
loadSession, revisionPanelOpen, toggleRevisionPanel
|
||||
} = useEditorStore()
|
||||
const [sidebarOpen, setSidebarOpen] = useState(
|
||||
() => localStorage.getItem('sidebarOpen') !== 'false'
|
||||
@@ -89,7 +89,7 @@ export default function App(): JSX.Element {
|
||||
<main className="editor-area" style={{ position: 'relative' }}>
|
||||
<AnalysisToolbar />
|
||||
<div className="editor-body">
|
||||
{outlineOpen && <DocumentOutline />}
|
||||
<DocumentOutline />
|
||||
<MarkdownEditor />
|
||||
</div>
|
||||
{revisionPanelOpen && <RevisionPanel />}
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
.outline-panel {
|
||||
width: 160px;
|
||||
min-width: 160px;
|
||||
width: 0;
|
||||
min-width: 0;
|
||||
flex-shrink: 0;
|
||||
background: var(--sidebar-bg);
|
||||
border-right: 1px solid var(--border);
|
||||
border-right: 0px solid var(--border);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
transition: width 0.2s ease, border-right-width 0.2s ease;
|
||||
}
|
||||
|
||||
.outline-panel--open {
|
||||
width: 160px;
|
||||
border-right-width: 1px;
|
||||
}
|
||||
|
||||
.outline-header {
|
||||
|
||||
@@ -42,10 +42,11 @@ function navigateTo(offset: number): void {
|
||||
|
||||
export function DocumentOutline(): JSX.Element {
|
||||
const activeFileContent = useEditorStore((s) => s.activeFileContent)
|
||||
const outlineOpen = useEditorStore((s) => s.outlineOpen)
|
||||
const items = useMemo(() => parseOutline(activeFileContent), [activeFileContent])
|
||||
|
||||
return (
|
||||
<div className="outline-panel">
|
||||
<div className={`outline-panel${outlineOpen ? ' outline-panel--open' : ''}`}>
|
||||
<div className="outline-header">OUTLINE</div>
|
||||
<div className="outline-list">
|
||||
{items.length === 0 ? (
|
||||
|
||||
Reference in New Issue
Block a user