Skip to content

Commit 0ed5c71

Browse files
Revert sidebar hover actions
Restore the previous File Explorer and Outline header and scrolling behavior. The hover overlay did not produce the intended sidebar layout.
1 parent faf460f commit 0ed5c71

5 files changed

Lines changed: 25 additions & 108 deletions

File tree

src/features/file-explorer/components/file-explorer-tree.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ import {
6363
DropdownMenuSubTrigger,
6464
DropdownMenuTrigger,
6565
} from "@/ui/dropdown";
66-
import { SidebarHeader, SidebarIconButton, SidebarPanel, SidebarSearchPopover } from "@/ui/sidebar";
66+
import { SidebarHeader, SidebarIconButton, SidebarSearchPopover } from "@/ui/sidebar";
6767
import { Spinner } from "@/ui/spinner";
6868
import { cn } from "@/utils/cn";
6969
import { frontendTrace } from "@/utils/frontend-trace";
@@ -1096,9 +1096,9 @@ function FileExplorerTreeComponent({
10961096
}, [activePath]);
10971097

10981098
return (
1099-
<SidebarPanel
1099+
<div
11001100
className={cn(
1101-
"flex-1 select-none",
1101+
"relative flex min-h-0 min-w-0 flex-1 select-none flex-col overflow-hidden p-0",
11021102
dragState.dragOverPath === "__ROOT__" &&
11031103
"border-2! border-dashed! border-primary! bg-primary! bg-opacity-10!",
11041104
)}
@@ -1281,7 +1281,7 @@ function FileExplorerTreeComponent({
12811281
onMouseLeave={handleContainerMouseLeave}
12821282
>
12831283
<SidebarHeader
1284-
variant="hover-actions"
1284+
className="justify-end"
12851285
onClick={(event) => event.stopPropagation()}
12861286
onMouseDown={(event) => event.stopPropagation()}
12871287
>
@@ -1670,7 +1670,7 @@ function FileExplorerTreeComponent({
16701670
</p>
16711671
</Dialog>
16721672
)}
1673-
</SidebarPanel>
1673+
</div>
16741674
);
16751675
}
16761676

src/features/file-explorer/components/file-explorer-viewport.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
getFileTreeVirtualRange,
1818
type FileTreeScrollAlignment,
1919
} from "@/features/file-explorer/lib/file-tree-viewport";
20-
import { SidebarTreeScrollArea } from "@/ui/sidebar";
2120
import { cn } from "@/utils/cn";
2221

2322
export interface FileExplorerViewportHandle {
@@ -208,17 +207,19 @@ export const FileExplorerViewport = forwardRef<
208207
const stickyIndexSet = useMemo(() => new Set(stickyIndexes), [stickyIndexes]);
209208

210209
return (
211-
<SidebarTreeScrollArea
212-
className={cn("file-tree-container font-sans", className)}
213-
contentPadding="inline"
214-
viewportClassName="overscroll-none scroll-auto [overflow-anchor:none]"
215-
viewportProps={{ ref: scrollRef, ...props }}
210+
<div
211+
ref={scrollRef}
212+
className={cn(
213+
"file-tree-container relative overflow-x-hidden overflow-y-auto overscroll-none scroll-auto scrollbar-gutter-both font-sans [overflow-anchor:none]",
214+
className,
215+
)}
216216
style={
217217
{
218218
"--file-tree-row-height": `${rowHeight}px`,
219219
...style,
220220
} as React.CSSProperties
221221
}
222+
{...props}
222223
>
223224
{stickyIndexes.length > 0 ? (
224225
<div
@@ -261,6 +262,6 @@ export const FileExplorerViewport = forwardRef<
261262
)}
262263
</div>
263264
{emptyState}
264-
</SidebarTreeScrollArea>
265+
</div>
265266
);
266267
});

src/features/layout/tests/sidebar-hover-actions.test.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/features/outline/components/outline-sidebar.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,8 @@ import { readFileContent } from "@/features/file-system/controllers/file-operati
3030
import { openFile } from "@/features/file-system/controllers/platform";
3131
import { useBufferStore } from "@/features/editor/stores/buffer.store";
3232
import { EmptyState } from "@/ui/empty";
33-
import {
34-
SidebarHeader,
35-
SidebarIconButton,
36-
SidebarPanel,
37-
SidebarSearchPopover,
38-
SidebarTreeScrollArea,
39-
} from "@/ui/sidebar";
33+
import { SidebarHeader, SidebarIconButton, SidebarSearchPopover, SidebarPanel } from "@/ui/sidebar";
34+
import { ScrollArea } from "@/ui/scroll-area";
4035
import { Spinner } from "@/ui/spinner";
4136
import { useDocumentOutline } from "../hooks/use-document-outline";
4237
import { getOutlineRevealScrollTop } from "../utils/outline-scroll";
@@ -278,7 +273,7 @@ export function OutlineSidebar() {
278273

279274
return (
280275
<SidebarPanel onKeyDownCapture={handleSidebarKeyDown}>
281-
<SidebarHeader variant="hover-actions">
276+
<SidebarHeader>
282277
<SidebarSearchPopover
283278
value={query}
284279
onChange={setQuery}
@@ -329,7 +324,7 @@ export function OutlineSidebar() {
329324
</DropdownMenu>
330325
</SidebarHeader>
331326

332-
<SidebarTreeScrollArea
327+
<ScrollArea
333328
className="min-h-0 min-w-0 flex-1"
334329
viewportClassName="overscroll-contain"
335330
viewportProps={{
@@ -340,6 +335,7 @@ export function OutlineSidebar() {
340335
scrollPaddingBlock: "4px",
341336
},
342337
}}
338+
contentClassName="p-1"
343339
>
344340
{!isSupported ? (
345341
<EmptyState
@@ -426,7 +422,7 @@ export function OutlineSidebar() {
426422
</ContextMenu>
427423
))
428424
)}
429-
</SidebarTreeScrollArea>
425+
</ScrollArea>
430426
</SidebarPanel>
431427
);
432428
}

src/ui/sidebar.tsx

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
useEffect,
88
useState,
99
} from "react";
10-
import { cva, type VariantProps } from "class-variance-authority";
1110
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/ui/accordion";
1211
import { Button, type ButtonProps } from "@/ui/button";
1312
import { ChromeBar } from "@/ui/chrome";
@@ -27,10 +26,9 @@ export function SidebarPanel({
2726
return (
2827
<div
2928
className={cn(
30-
"group/sidebar-panel relative flex size-full min-h-0 min-w-0 flex-col overflow-hidden bg-background",
29+
"flex size-full min-h-0 min-w-0 flex-col overflow-hidden bg-background",
3130
className,
3231
)}
33-
data-slot="sidebar-panel"
3432
{...props}
3533
>
3634
{children}
@@ -68,35 +66,6 @@ export function SidebarScrollArea({
6866
return <ScrollArea className={className} contentClassName="px-chrome-inline py-2" {...props} />;
6967
}
7068

71-
const sidebarTreeScrollContentVariants = cva("", {
72-
variants: {
73-
padding: {
74-
all: "p-1",
75-
inline: "px-1",
76-
},
77-
},
78-
defaultVariants: {
79-
padding: "all",
80-
},
81-
});
82-
83-
export function SidebarTreeScrollArea({
84-
className,
85-
contentPadding = "all",
86-
...props
87-
}: Omit<ComponentProps<typeof ScrollArea>, "contentClassName" | "reserveScrollbarGutter"> & {
88-
contentPadding?: "all" | "inline";
89-
}) {
90-
return (
91-
<ScrollArea
92-
className={className}
93-
contentClassName={sidebarTreeScrollContentVariants({ padding: contentPadding })}
94-
reserveScrollbarGutter
95-
{...props}
96-
/>
97-
);
98-
}
99-
10069
export function SidebarTitleBar({
10170
title,
10271
children,
@@ -169,32 +138,18 @@ export const SidebarFooter = forwardRef<
169138
);
170139
});
171140

172-
const sidebarHeaderVariants = cva("select-none", {
173-
variants: {
174-
variant: {
175-
default: "sticky top-0 z-20 h-sidebar-header py-1 backdrop-blur-sm",
176-
"hover-actions":
177-
"pointer-events-none absolute top-0 right-0 z-30 h-sidebar-header w-fit max-w-full justify-end py-1 opacity-0 backdrop-blur-sm transition-opacity duration-fast ease-smooth group-hover/sidebar-panel:pointer-events-auto group-hover/sidebar-panel:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100",
178-
},
179-
},
180-
defaultVariants: {
181-
variant: "default",
182-
},
183-
});
184-
185141
export function SidebarHeader({
186142
children,
187143
className,
188-
variant = "default",
189144
...props
190-
}: ComponentProps<"div"> &
191-
VariantProps<typeof sidebarHeaderVariants> & {
192-
children: ReactNode;
193-
}) {
145+
}: ComponentProps<"div"> & { children: ReactNode }) {
194146
return (
195147
<ChromeBar
196148
region="sidebar"
197-
className={cn(sidebarHeaderVariants({ variant }), className)}
149+
className={cn(
150+
"sticky top-0 z-20 h-sidebar-header select-none py-1 backdrop-blur-sm",
151+
className,
152+
)}
198153
{...props}
199154
>
200155
{children}

0 commit comments

Comments
 (0)