1
- import { Box } from "@mantine/core" ;
1
+ import { Box , Tooltip } from "@mantine/core" ;
2
2
import { ReactElement } from "react" ;
3
3
import { notifications } from "@mantine/notifications" ;
4
- import { IconCopy } from ' @tabler/icons-react' ;
4
+ import { IconCopy , IconEye } from " @tabler/icons-react" ;
5
5
6
- export function MiniCard ( args : { title : string , value : ReactElement | string , shortValue ?: string } ) {
6
+ export function MiniCard ( args : {
7
+ title : string ;
8
+ value : ReactElement | string ;
9
+ shortValue ?: string ;
10
+ } ) {
7
11
const copyContent = async ( ) => {
8
12
if ( typeof args . value === "string" ) {
9
13
try {
@@ -21,28 +25,69 @@ export function MiniCard(args: { title: string, value: ReactElement | string, sh
21
25
} ) ;
22
26
}
23
27
}
24
- }
28
+ } ;
25
29
26
30
return (
27
- < Box style = { {
28
- border : "1px solid #f0f0f0" ,
29
- borderRadius : 4 ,
30
- padding : 16 ,
31
- marginBottom : 16 ,
32
- marginLeft : 8 ,
33
- marginRight : 8
34
- } } >
35
- < div style = { {
36
- fontSize : 12 ,
37
- color : "#666" ,
38
- display : "flex" ,
39
- flexDirection : "row" ,
40
- justifyContent : "space-between"
41
- } } > { args . title } { args . shortValue && < IconCopy cursor = "pointer" onClick = { copyContent } size = "1rem" stroke = { 1.5 } /> } </ div >
42
- < div style = { {
43
- fontWeight : 600 ,
44
- color : "#333"
45
- } } > { args . shortValue || args . value } </ div >
31
+ < Box
32
+ style = { {
33
+ border : "1px solid #f0f0f0" ,
34
+ borderRadius : 4 ,
35
+ padding : 16 ,
36
+ marginBottom : 16 ,
37
+ marginLeft : 8 ,
38
+ marginRight : 8 ,
39
+ } }
40
+ >
41
+ < div
42
+ style = { {
43
+ fontSize : 12 ,
44
+ color : "#666" ,
45
+ display : "flex" ,
46
+ flexDirection : "row" ,
47
+ justifyContent : "space-between" ,
48
+ } }
49
+ >
50
+ { args . title }
51
+ { args . shortValue && (
52
+ < div
53
+ style = { {
54
+ display : "flex" ,
55
+ flexDirection : "row" ,
56
+ columnGap : "10px" ,
57
+ } }
58
+ >
59
+ < Tooltip
60
+ label = {
61
+ < div
62
+ style = { {
63
+ maxWidth : "800px" ,
64
+ whiteSpace : "normal" ,
65
+ wordWrap : "break-word" ,
66
+ } }
67
+ >
68
+ { args . value }
69
+ </ div >
70
+ }
71
+ >
72
+ < IconEye cursor = "pointer" size = "1rem" stroke = { 1.5 } > </ IconEye >
73
+ </ Tooltip >
74
+ < IconCopy
75
+ cursor = "pointer"
76
+ onClick = { copyContent }
77
+ size = "1rem"
78
+ stroke = { 1.5 }
79
+ />
80
+ </ div >
81
+ ) }
82
+ </ div >
83
+ < div
84
+ style = { {
85
+ fontWeight : 600 ,
86
+ color : "#333" ,
87
+ } }
88
+ >
89
+ { args . shortValue || args . value }
90
+ </ div >
46
91
</ Box >
47
- )
92
+ ) ;
48
93
}
0 commit comments