style(webui): emphasize active compare pane topbar

The active version's topbar now uses an inverted bar (bg-foreground /
text-background) so it reads as black background with white text in the
light theme, while the inactive pane keeps the card background with muted
text. Filename/version text color now differs between active and inactive
panes.
This commit is contained in:
yiling
2026-07-04 11:19:50 +08:00
parent 78c8a56183
commit a4e25db0f7
2 changed files with 27 additions and 12 deletions
@@ -40,12 +40,15 @@ export function ComparePaneTopbar({
onSwitchVersion,
onExit,
}: ComparePaneTopbarProps) {
const iconButtonClass = cn(
'flex-shrink-0 rounded p-1 transition-colors',
isActive
? 'text-background/70 hover:bg-background/20 hover:text-background'
: 'text-muted-foreground hover:bg-accent hover:text-foreground',
)
const exitButton = (
<button
onClick={onExit}
title={m.exit_compare()}
className="flex-shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
>
<button onClick={onExit} title={m.exit_compare()} className={iconButtonClass}>
<X className="h-4 w-4" />
</button>
)
@@ -53,11 +56,21 @@ export function ComparePaneTopbar({
const label = (
<button
onClick={onActivate}
className="flex min-w-0 items-center gap-1 rounded px-2 py-1 text-sm font-medium text-foreground transition-colors hover:bg-accent hover:text-accent-foreground"
className={cn(
'flex min-w-0 items-center gap-1 rounded px-2 py-1 text-sm font-medium transition-colors',
isActive
? 'text-background hover:bg-background/20'
: 'text-muted-foreground hover:bg-accent hover:text-accent-foreground',
)}
>
<span className="truncate">{fileName}</span>
{version !== undefined && (
<span className="flex-shrink-0 rounded border border-border px-1 py-0 text-xs">
<span
className={cn(
'flex-shrink-0 rounded border px-1 py-0 text-xs',
isActive ? 'border-background/40' : 'border-border',
)}
>
v{version}
</span>
)}
@@ -69,7 +82,7 @@ export function ComparePaneTopbar({
<DropdownMenuTrigger
onClick={onActivate}
title={m.switch_version()}
className="flex-shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
className={iconButtonClass}
>
<ChevronDown className="h-4 w-4" />
</DropdownMenuTrigger>
@@ -116,8 +129,10 @@ export function ComparePaneTopbar({
<div
onMouseDown={onActivate}
className={cn(
'flex h-10 flex-shrink-0 items-center gap-1 border-b bg-card px-2',
isActive ? 'border-b-2 border-primary' : 'border-border',
'flex h-10 flex-shrink-0 items-center gap-1 border-b px-2 transition-colors',
isActive
? 'border-b-2 border-primary bg-foreground text-background'
: 'border-border bg-card text-muted-foreground',
)}
>
{side === 'left' ? (
@@ -7,8 +7,8 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { CompareControlBar } from './compare-control-bar'
import { CompareImagePane } from './compare-image-pane'
import { ComparePaneTopbar } from './compare-pane-topbar'
import { isSameType, kindOf } from './compare-utils'
import { CompareVideoPane } from './compare-video-pane'
import { kindOf, isSameType } from './compare-utils'
import type { ComparePaneHandle, CompareSide, PaneKind, PaneReportedState } from './types'
interface VersionItem {
@@ -274,7 +274,7 @@ export function CompareViewer({
<div ref={rootRef} className="flex h-full flex-1 flex-col bg-background">
<div className="flex min-h-0 flex-1">
{/* Left pane */}
<div className="flex min-w-0 flex-1 flex-col border-r border-border">
<div className="flex min-w-0 flex-1 flex-col border-r border-zinc-800">
{leftAsset && (
<ComparePaneTopbar
side="left"