Skip to content

Commit bf442a5

Browse files
committed
fix(ui): mute inactive file tab icons
1 parent 09e1b98 commit bf442a5

2 files changed

Lines changed: 39 additions & 17 deletions

File tree

packages/app/src/components/session/session-sortable-tab.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ import { useCommand } from "@/context/command"
1313
export function FileVisual(props: { path: string; active?: boolean }): JSX.Element {
1414
return (
1515
<div class="flex items-center gap-x-1.5 min-w-0">
16-
<FileIcon
17-
node={{ path: props.path, type: "file" }}
18-
classList={{
19-
"grayscale-100 group-data-[selected]/tab:grayscale-0": !props.active,
20-
"grayscale-0": props.active,
21-
}}
22-
/>
16+
<Show
17+
when={!props.active}
18+
fallback={<FileIcon node={{ path: props.path, type: "file" }} class="size-4 shrink-0" />}
19+
>
20+
<span class="relative inline-flex size-4 shrink-0">
21+
<FileIcon node={{ path: props.path, type: "file" }} class="absolute inset-0 size-4 tab-fileicon-color" />
22+
<FileIcon node={{ path: props.path, type: "file" }} mono class="absolute inset-0 size-4 tab-fileicon-mono" />
23+
</span>
24+
</Show>
2325
<span class="text-14-medium truncate">{getFilename(props.path)}</span>
2426
</div>
2527
)

packages/ui/src/components/tabs.css

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,20 +229,40 @@
229229
}
230230
}
231231

232-
[data-component="file-icon"] {
233-
filter: grayscale(1) !important;
234-
transition: filter 120ms ease;
232+
&:hover:not(:disabled):not(:has([data-selected])) {
233+
color: var(--text-base);
234+
background-color: var(--surface-base-hover);
235235
}
236236

237-
&:has([data-selected]) {
238-
[data-component="file-icon"] {
239-
filter: grayscale(0) !important;
237+
/*
238+
File tabs: use monochrome icon by default.
239+
Full-color icon is shown on hover/selected.
240+
*/
241+
[data-slot="tabs-trigger"] {
242+
.tab-fileicon-color,
243+
.tab-fileicon-mono {
244+
transition: opacity 120ms ease;
240245
}
241-
}
242246

243-
&:hover:not(:disabled):not(:has([data-selected])) {
244-
color: var(--text-base);
245-
background-color: var(--surface-base-hover);
247+
.tab-fileicon-color {
248+
opacity: 0;
249+
}
250+
251+
.tab-fileicon-mono {
252+
opacity: 1;
253+
color: currentColor;
254+
}
255+
256+
&[data-selected],
257+
&:hover {
258+
.tab-fileicon-color {
259+
opacity: 1;
260+
}
261+
262+
.tab-fileicon-mono {
263+
opacity: 0;
264+
}
265+
}
246266
}
247267
}
248268
}

0 commit comments

Comments
 (0)