💄 slide-in animation for the header nav

This commit is contained in:
2026-03-03 20:17:01 +10:00
parent 68824af1af
commit ac49c3df72
3 changed files with 13 additions and 6 deletions

View File

@@ -11,7 +11,7 @@ import './styles/app.css'
export default function App(): JSX.Element { export default function App(): JSX.Element {
const { const {
setFileTree, activeFilePath, isDirty, markSaved, activeFileContent, theme, toggleTheme, setFileTree, activeFilePath, isDirty, markSaved, activeFileContent, theme, toggleTheme,
loadSession, revisionPanelOpen, toggleRevisionPanel, outlineOpen loadSession, revisionPanelOpen, toggleRevisionPanel
} = useEditorStore() } = useEditorStore()
const [sidebarOpen, setSidebarOpen] = useState( const [sidebarOpen, setSidebarOpen] = useState(
() => localStorage.getItem('sidebarOpen') !== 'false' () => localStorage.getItem('sidebarOpen') !== 'false'
@@ -89,7 +89,7 @@ export default function App(): JSX.Element {
<main className="editor-area" style={{ position: 'relative' }}> <main className="editor-area" style={{ position: 'relative' }}>
<AnalysisToolbar /> <AnalysisToolbar />
<div className="editor-body"> <div className="editor-body">
{outlineOpen && <DocumentOutline />} <DocumentOutline />
<MarkdownEditor /> <MarkdownEditor />
</div> </div>
{revisionPanelOpen && <RevisionPanel />} {revisionPanelOpen && <RevisionPanel />}

View File

@@ -1,12 +1,18 @@
.outline-panel { .outline-panel {
width: 160px; width: 0;
min-width: 160px; min-width: 0;
flex-shrink: 0; flex-shrink: 0;
background: var(--sidebar-bg); background: var(--sidebar-bg);
border-right: 1px solid var(--border); border-right: 0px solid var(--border);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
transition: width 0.2s ease, border-right-width 0.2s ease;
}
.outline-panel--open {
width: 160px;
border-right-width: 1px;
} }
.outline-header { .outline-header {

View File

@@ -42,10 +42,11 @@ function navigateTo(offset: number): void {
export function DocumentOutline(): JSX.Element { export function DocumentOutline(): JSX.Element {
const activeFileContent = useEditorStore((s) => s.activeFileContent) const activeFileContent = useEditorStore((s) => s.activeFileContent)
const outlineOpen = useEditorStore((s) => s.outlineOpen)
const items = useMemo(() => parseOutline(activeFileContent), [activeFileContent]) const items = useMemo(() => parseOutline(activeFileContent), [activeFileContent])
return ( return (
<div className="outline-panel"> <div className={`outline-panel${outlineOpen ? ' outline-panel--open' : ''}`}>
<div className="outline-header">OUTLINE</div> <div className="outline-header">OUTLINE</div>
<div className="outline-list"> <div className="outline-list">
{items.length === 0 ? ( {items.length === 0 ? (