1
1
import { SectionToggle } from './SectionToggle'
2
- import { type TableDiffData , type SampleValue , themeColors } from './types'
2
+ import { type TableDiffData , type SampleValue } from './types'
3
+ import { twColors , twMerge } from './tailwind-utils'
3
4
4
5
interface ColumnStatsSectionProps {
5
6
columnStats : TableDiffData [ 'row_diff' ] [ 'column_stats' ]
@@ -14,9 +15,8 @@ interface StatHeaderProps {
14
15
const StatHeader = ( { stat } : StatHeaderProps ) => (
15
16
< th
16
17
key = { stat }
17
- className = " text-left py-2 px-1 font-medium w-16"
18
+ className = { twMerge ( ' text-left py-2 px-1 font-medium w-16' , twColors . textMuted ) }
18
19
title = { stat }
19
- style = { { color : themeColors . muted } }
20
20
>
21
21
{ stat . length > 6 ? stat . slice ( 0 , 6 ) + '..' : stat }
22
22
</ th >
@@ -28,9 +28,8 @@ interface StatCellProps {
28
28
29
29
const StatCell = ( { value } : StatCellProps ) => (
30
30
< td
31
- className = " py-2 px-1 font-mono text-xs truncate"
31
+ className = { twMerge ( ' py-2 px-1 font-mono text-xs truncate' , twColors . textMuted ) }
32
32
title = { String ( value ) }
33
- style = { { color : themeColors . muted } }
34
33
>
35
34
{ typeof value === 'number'
36
35
? value . toFixed ( 1 )
@@ -47,17 +46,11 @@ interface ColumnStatRowProps {
47
46
48
47
const ColumnStatRow = ( { columnName, statsValue } : ColumnStatRowProps ) => (
49
48
< tr
50
- className = "transition-colors"
51
- style = { {
52
- borderBottom : `1px solid ${ themeColors . border } ` ,
53
- } }
54
- onMouseEnter = { e => {
55
- e . currentTarget . style . backgroundColor =
56
- 'var(--vscode-list-hoverBackground)'
57
- } }
58
- onMouseLeave = { e => {
59
- e . currentTarget . style . backgroundColor = 'transparent'
60
- } }
49
+ className = { twMerge (
50
+ 'transition-colors border-b' ,
51
+ twColors . borderPanel ,
52
+ twColors . bgHover
53
+ ) }
61
54
>
62
55
< td
63
56
className = "py-2 pr-2 font-mono truncate"
@@ -94,32 +87,21 @@ export function ColumnStatsSection({
94
87
id = "columnStats"
95
88
title = "Column Statistics"
96
89
badge = { `${ Object . keys ( columnStats ) . length } columns` }
97
- badgeStyle = { {
98
- backgroundColor : 'var(--vscode-input-background)' ,
99
- color : 'var(--vscode-symbolIcon-classForeground, #9b59b6)' ,
100
- borderColor : 'var(--vscode-symbolIcon-classForeground, #9b59b6)' ,
101
- } }
90
+ badgeClassName = { twMerge (
91
+ 'px-2 py-1 text-xs rounded border' ,
92
+ twColors . bgInput ,
93
+ 'text-[var(--vscode-symbolIcon-classForeground,#9b59b6)]' ,
94
+ 'border-[var(--vscode-symbolIcon-classForeground,#9b59b6)]'
95
+ ) }
102
96
expanded = { expanded }
103
97
onToggle = { onToggle }
104
98
>
105
99
< div className = "px-8 py-3" >
106
100
< div className = "overflow-auto max-h-80" >
107
101
< table className = "w-full text-xs table-fixed" >
108
- < thead
109
- className = "sticky top-0 z-10"
110
- style = { {
111
- backgroundColor : 'var(--vscode-editor-background)' ,
112
- } }
113
- >
114
- < tr
115
- style = { {
116
- borderBottom : `1px solid ${ themeColors . border } ` ,
117
- } }
118
- >
119
- < th
120
- className = "text-left py-2 pr-2 font-medium w-28"
121
- style = { { color : themeColors . muted } }
122
- >
102
+ < thead className = { twMerge ( 'sticky top-0 z-10' , twColors . bgEditor ) } >
103
+ < tr className = { twMerge ( 'border-b' , twColors . borderPanel ) } >
104
+ < th className = { twMerge ( 'text-left py-2 pr-2 font-medium w-28' , twColors . textMuted ) } >
123
105
Column
124
106
</ th >
125
107
{ statKeys . map ( stat => (
0 commit comments