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, onSwitchVersion,
onExit, onExit,
}: ComparePaneTopbarProps) { }: 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 = ( const exitButton = (
<button <button onClick={onExit} title={m.exit_compare()} className={iconButtonClass}>
onClick={onExit}
title={m.exit_compare()}
className="flex-shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
>
<X className="h-4 w-4" /> <X className="h-4 w-4" />
</button> </button>
) )
@@ -53,11 +56,21 @@ export function ComparePaneTopbar({
const label = ( const label = (
<button <button
onClick={onActivate} 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> <span className="truncate">{fileName}</span>
{version !== undefined && ( {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} v{version}
</span> </span>
)} )}
@@ -69,7 +82,7 @@ export function ComparePaneTopbar({
<DropdownMenuTrigger <DropdownMenuTrigger
onClick={onActivate} onClick={onActivate}
title={m.switch_version()} 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" /> <ChevronDown className="h-4 w-4" />
</DropdownMenuTrigger> </DropdownMenuTrigger>
@@ -116,8 +129,10 @@ export function ComparePaneTopbar({
<div <div
onMouseDown={onActivate} onMouseDown={onActivate}
className={cn( className={cn(
'flex h-10 flex-shrink-0 items-center gap-1 border-b bg-card px-2', 'flex h-10 flex-shrink-0 items-center gap-1 border-b px-2 transition-colors',
isActive ? 'border-b-2 border-primary' : 'border-border', isActive
? 'border-b-2 border-primary bg-foreground text-background'
: 'border-border bg-card text-muted-foreground',
)} )}
> >
{side === 'left' ? ( {side === 'left' ? (
@@ -7,8 +7,8 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { CompareControlBar } from './compare-control-bar' import { CompareControlBar } from './compare-control-bar'
import { CompareImagePane } from './compare-image-pane' import { CompareImagePane } from './compare-image-pane'
import { ComparePaneTopbar } from './compare-pane-topbar' import { ComparePaneTopbar } from './compare-pane-topbar'
import { isSameType, kindOf } from './compare-utils'
import { CompareVideoPane } from './compare-video-pane' import { CompareVideoPane } from './compare-video-pane'
import { kindOf, isSameType } from './compare-utils'
import type { ComparePaneHandle, CompareSide, PaneKind, PaneReportedState } from './types' import type { ComparePaneHandle, CompareSide, PaneKind, PaneReportedState } from './types'
interface VersionItem { interface VersionItem {
@@ -274,7 +274,7 @@ export function CompareViewer({
<div ref={rootRef} className="flex h-full flex-1 flex-col bg-background"> <div ref={rootRef} className="flex h-full flex-1 flex-col bg-background">
<div className="flex min-h-0 flex-1"> <div className="flex min-h-0 flex-1">
{/* Left pane */} {/* 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 && ( {leftAsset && (
<ComparePaneTopbar <ComparePaneTopbar
side="left" side="left"