@@ -40,6 +40,7 @@ export const FieldList: React.FC<FieldListProps> = ({
4040 key = { field . id }
4141 onClick = { ( ) => onSelect ( field ) }
4242 style = { {
43+ position : "relative" ,
4344 padding : "12px" ,
4445 background :
4546 selectedFieldId === field . id ? "#eff6ff" : "#f9fafb" ,
@@ -61,55 +62,72 @@ export const FieldList: React.FC<FieldListProps> = ({
6162 e . currentTarget . style . background = "#f9fafb" ;
6263 }
6364 } }
65+ title = { field . alias }
6466 >
65- < div
67+ < button
68+ onClick = { ( e ) => {
69+ e . stopPropagation ( ) ;
70+ onDelete ( field . id ) ;
71+ } }
6672 style = { {
73+ position : "absolute" ,
74+ top : "8px" ,
75+ right : "8px" ,
76+ padding : "4px" ,
77+ background : "transparent" ,
78+ border : "none" ,
79+ cursor : "pointer" ,
80+ color : "#9ca3af" ,
81+ transition : "color 0.2s" ,
6782 display : "flex" ,
68- justifyContent : "space-between" ,
6983 alignItems : "center" ,
84+ justifyContent : "center" ,
85+ } }
86+ onMouseEnter = { ( e ) => {
87+ e . currentTarget . style . color = "#ef4444" ;
7088 } }
89+ onMouseLeave = { ( e ) => {
90+ e . currentTarget . style . color = "#9ca3af" ;
91+ } }
92+ title = "Delete field"
7193 >
72- < div >
94+ < svg
95+ width = "16"
96+ height = "16"
97+ viewBox = "0 0 16 16"
98+ fill = "none"
99+ xmlns = "http://www.w3.org/2000/svg"
100+ >
101+ < path
102+ d = "M6 2V1.5C6 1.22386 6.22386 1 6.5 1H9.5C9.77614 1 10 1.22386 10 1.5V2M2 4H14M12.6667 4L12.1991 11.0129C12.129 12.065 12.0939 12.5911 11.8667 12.99C11.6666 13.3412 11.3648 13.6235 11.0011 13.7998C10.588 14 10.0607 14 9.00623 14H6.99377C5.93927 14 5.41202 14 4.99889 13.7998C4.63517 13.6235 4.33339 13.3412 4.13332 12.99C3.90607 12.5911 3.871 12.065 3.80086 11.0129L3.33333 4"
103+ stroke = "currentColor"
104+ strokeWidth = "1.5"
105+ strokeLinecap = "round"
106+ strokeLinejoin = "round"
107+ />
108+ </ svg >
109+ </ button >
110+ < div style = { { paddingRight : "24px" } } >
111+ < div
112+ style = { {
113+ fontWeight : "500" ,
114+ fontSize : "14px" ,
115+ marginBottom :
116+ field . alias && field . alias !== field . id ? "4px" : "0" ,
117+ } }
118+ >
119+ { field . id }
120+ </ div >
121+ { field . alias && field . alias !== field . id && (
73122 < div
74123 style = { {
75- fontWeight : "500" ,
76- fontSize : "14px" ,
77- marginBottom : "4px" ,
124+ fontSize : "12px" ,
125+ color : "#4b5563" ,
78126 } }
79127 >
80128 { field . alias }
81129 </ div >
82- { field . tag && (
83- < div style = { { fontSize : "12px" , color : "#6b7280" } } >
84- { field . tag }
85- </ div >
86- ) }
87- </ div >
88- < button
89- onClick = { ( e ) => {
90- e . stopPropagation ( ) ;
91- onDelete ( field . id ) ;
92- } }
93- style = { {
94- padding : "4px 8px" ,
95- background : "#ef4444" ,
96- color : "white" ,
97- border : "none" ,
98- borderRadius : "4px" ,
99- fontSize : "12px" ,
100- cursor : "pointer" ,
101- opacity : 0.8 ,
102- transition : "opacity 0.2s" ,
103- } }
104- onMouseEnter = { ( e ) => {
105- e . currentTarget . style . opacity = "1" ;
106- } }
107- onMouseLeave = { ( e ) => {
108- e . currentTarget . style . opacity = "0.8" ;
109- } }
110- >
111- Delete
112- </ button >
130+ ) }
113131 </ div >
114132 </ div >
115133 ) ) }
0 commit comments