@@ -8,15 +8,15 @@ import { resetComponent, textEllipsis } from '../../style';
8
8
9
9
export interface ComponentToken {
10
10
zIndexPopup : number ;
11
+ previewOperationSize : number ;
12
+ previewOperationColor : string ;
13
+ previewOperationColorDisabled : string ;
11
14
}
12
15
13
16
export interface ImageToken extends FullToken < 'Image' > {
14
17
previewCls : string ;
15
18
modalMaskBg : string ;
16
- imagePreviewOperationDisabledColor : string ;
17
- imagePreviewOperationSize : number ;
18
19
imagePreviewSwitchSize : number ;
19
- imagePreviewOperationColor : string ;
20
20
}
21
21
22
22
export type PositionType = 'static' | 'relative' | 'fixed' | 'absolute' | 'sticky' | undefined ;
@@ -45,19 +45,17 @@ export const genImageMaskStyle = (token: ImageToken): CSSObject => {
45
45
padding : `0 ${ paddingXXS } px` ,
46
46
[ iconCls ] : {
47
47
marginInlineEnd : marginXXS ,
48
+ svg : {
49
+ verticalAlign : 'baseline' ,
50
+ } ,
48
51
} ,
49
52
} ,
50
53
} ;
51
54
} ;
52
55
53
56
export const genPreviewOperationsStyle = ( token : ImageToken ) : CSSObject => {
54
- const {
55
- previewCls,
56
- modalMaskBg,
57
- paddingSM,
58
- imagePreviewOperationDisabledColor,
59
- motionDurationSlow,
60
- } = token ;
57
+ const { previewCls, modalMaskBg, paddingSM, previewOperationColorDisabled, motionDurationSlow } =
58
+ token ;
61
59
62
60
const operationBg = new TinyColor ( modalMaskBg ) . setAlpha ( 0.1 ) ;
63
61
const operationBgHover = operationBg . clone ( ) . setAlpha ( 0.2 ) ;
@@ -68,7 +66,7 @@ export const genPreviewOperationsStyle = (token: ImageToken): CSSObject => {
68
66
display : 'flex' ,
69
67
flexDirection : 'row-reverse' ,
70
68
alignItems : 'center' ,
71
- color : token . imagePreviewOperationColor ,
69
+ color : token . previewOperationColor ,
72
70
listStyle : 'none' ,
73
71
background : operationBg . toRgbString ( ) ,
74
72
pointerEvents : 'auto' ,
@@ -78,13 +76,14 @@ export const genPreviewOperationsStyle = (token: ImageToken): CSSObject => {
78
76
padding : paddingSM ,
79
77
cursor : 'pointer' ,
80
78
transition : `all ${ motionDurationSlow } ` ,
79
+ userSelect : 'none' ,
81
80
82
81
'&:hover' : {
83
82
background : operationBgHover . toRgbString ( ) ,
84
83
} ,
85
84
86
85
'&-disabled' : {
87
- color : imagePreviewOperationDisabledColor ,
86
+ color : previewOperationColorDisabled ,
88
87
pointerEvents : 'none' ,
89
88
} ,
90
89
@@ -100,7 +99,7 @@ export const genPreviewOperationsStyle = (token: ImageToken): CSSObject => {
100
99
} ,
101
100
102
101
'&-icon' : {
103
- fontSize : token . imagePreviewOperationSize ,
102
+ fontSize : token . previewOperationSize ,
104
103
} ,
105
104
} ,
106
105
} ;
@@ -110,7 +109,7 @@ export const genPreviewSwitchStyle = (token: ImageToken): CSSObject => {
110
109
const {
111
110
modalMaskBg,
112
111
iconCls,
113
- imagePreviewOperationDisabledColor ,
112
+ previewOperationColorDisabled ,
114
113
previewCls,
115
114
zIndexPopup,
116
115
motionDurationSlow,
@@ -130,21 +129,22 @@ export const genPreviewSwitchStyle = (token: ImageToken): CSSObject => {
130
129
width : token . imagePreviewSwitchSize ,
131
130
height : token . imagePreviewSwitchSize ,
132
131
marginTop : - token . imagePreviewSwitchSize / 2 ,
133
- color : token . imagePreviewOperationColor ,
132
+ color : token . previewOperationColor ,
134
133
background : operationBg . toRgbString ( ) ,
135
134
borderRadius : '50%' ,
136
135
transform : `translateY(-50%)` ,
137
136
cursor : 'pointer' ,
138
137
transition : `all ${ motionDurationSlow } ` ,
139
138
pointerEvents : 'auto' ,
139
+ userSelect : 'none' ,
140
140
141
141
'&:hover' : {
142
142
background : operationBgHover . toRgbString ( ) ,
143
143
} ,
144
144
145
145
[ `&-disabled` ] : {
146
146
'&, &:hover' : {
147
- color : imagePreviewOperationDisabledColor ,
147
+ color : previewOperationColorDisabled ,
148
148
background : 'transparent' ,
149
149
cursor : 'not-allowed' ,
150
150
[ `> ${ iconCls } ` ] : {
@@ -153,7 +153,7 @@ export const genPreviewSwitchStyle = (token: ImageToken): CSSObject => {
153
153
} ,
154
154
} ,
155
155
[ `> ${ iconCls } ` ] : {
156
- fontSize : token . imagePreviewOperationSize ,
156
+ fontSize : token . previewOperationSize ,
157
157
} ,
158
158
} ,
159
159
@@ -295,17 +295,11 @@ const genPreviewMotion: GenerateStyle<ImageToken> = token => {
295
295
export default genComponentStyleHook (
296
296
'Image' ,
297
297
token => {
298
- const imagePreviewOperationColor = new TinyColor ( token . colorTextLightSolid ) ;
299
298
const previewCls = `${ token . componentCls } -preview` ;
300
299
301
300
const imageToken = mergeToken < ImageToken > ( token , {
302
301
previewCls,
303
- imagePreviewOperationColor : imagePreviewOperationColor . toRgbString ( ) ,
304
- imagePreviewOperationDisabledColor : new TinyColor ( imagePreviewOperationColor )
305
- . setAlpha ( 0.25 )
306
- . toRgbString ( ) ,
307
302
modalMaskBg : new TinyColor ( '#000' ) . setAlpha ( 0.45 ) . toRgbString ( ) , // FIXME: Shared Token
308
- imagePreviewOperationSize : token . fontSizeIcon * 1.5 , // FIXME: fontSizeIconLG
309
303
imagePreviewSwitchSize : token . controlHeightLG ,
310
304
} ) ;
311
305
@@ -318,5 +312,10 @@ export default genComponentStyleHook(
318
312
} ,
319
313
token => ( {
320
314
zIndexPopup : token . zIndexPopupBase + 80 ,
315
+ previewOperationColor : new TinyColor ( token . colorTextLightSolid ) . toRgbString ( ) ,
316
+ previewOperationColorDisabled : new TinyColor ( token . colorTextLightSolid )
317
+ . setAlpha ( 0.25 )
318
+ . toRgbString ( ) ,
319
+ previewOperationSize : token . fontSizeIcon * 1.5 , // FIXME: fontSizeIconLG
321
320
} ) ,
322
321
) ;
0 commit comments