@@ -8,15 +8,15 @@ import { resetComponent, textEllipsis } from '../../style';
88
99export interface ComponentToken {
1010 zIndexPopup : number ;
11+ previewOperationSize : number ;
12+ previewOperationColor : string ;
13+ previewOperationColorDisabled : string ;
1114}
1215
1316export interface ImageToken extends FullToken < 'Image' > {
1417 previewCls : string ;
1518 modalMaskBg : string ;
16- imagePreviewOperationDisabledColor : string ;
17- imagePreviewOperationSize : number ;
1819 imagePreviewSwitchSize : number ;
19- imagePreviewOperationColor : string ;
2020}
2121
2222export type PositionType = 'static' | 'relative' | 'fixed' | 'absolute' | 'sticky' | undefined ;
@@ -45,19 +45,17 @@ export const genImageMaskStyle = (token: ImageToken): CSSObject => {
4545 padding : `0 ${ paddingXXS } px` ,
4646 [ iconCls ] : {
4747 marginInlineEnd : marginXXS ,
48+ svg : {
49+ verticalAlign : 'baseline' ,
50+ } ,
4851 } ,
4952 } ,
5053 } ;
5154} ;
5255
5356export 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 ;
6159
6260 const operationBg = new TinyColor ( modalMaskBg ) . setAlpha ( 0.1 ) ;
6361 const operationBgHover = operationBg . clone ( ) . setAlpha ( 0.2 ) ;
@@ -68,7 +66,7 @@ export const genPreviewOperationsStyle = (token: ImageToken): CSSObject => {
6866 display : 'flex' ,
6967 flexDirection : 'row-reverse' ,
7068 alignItems : 'center' ,
71- color : token . imagePreviewOperationColor ,
69+ color : token . previewOperationColor ,
7270 listStyle : 'none' ,
7371 background : operationBg . toRgbString ( ) ,
7472 pointerEvents : 'auto' ,
@@ -78,13 +76,14 @@ export const genPreviewOperationsStyle = (token: ImageToken): CSSObject => {
7876 padding : paddingSM ,
7977 cursor : 'pointer' ,
8078 transition : `all ${ motionDurationSlow } ` ,
79+ userSelect : 'none' ,
8180
8281 '&:hover' : {
8382 background : operationBgHover . toRgbString ( ) ,
8483 } ,
8584
8685 '&-disabled' : {
87- color : imagePreviewOperationDisabledColor ,
86+ color : previewOperationColorDisabled ,
8887 pointerEvents : 'none' ,
8988 } ,
9089
@@ -100,7 +99,7 @@ export const genPreviewOperationsStyle = (token: ImageToken): CSSObject => {
10099 } ,
101100
102101 '&-icon' : {
103- fontSize : token . imagePreviewOperationSize ,
102+ fontSize : token . previewOperationSize ,
104103 } ,
105104 } ,
106105 } ;
@@ -110,7 +109,7 @@ export const genPreviewSwitchStyle = (token: ImageToken): CSSObject => {
110109 const {
111110 modalMaskBg,
112111 iconCls,
113- imagePreviewOperationDisabledColor ,
112+ previewOperationColorDisabled ,
114113 previewCls,
115114 zIndexPopup,
116115 motionDurationSlow,
@@ -130,21 +129,22 @@ export const genPreviewSwitchStyle = (token: ImageToken): CSSObject => {
130129 width : token . imagePreviewSwitchSize ,
131130 height : token . imagePreviewSwitchSize ,
132131 marginTop : - token . imagePreviewSwitchSize / 2 ,
133- color : token . imagePreviewOperationColor ,
132+ color : token . previewOperationColor ,
134133 background : operationBg . toRgbString ( ) ,
135134 borderRadius : '50%' ,
136135 transform : `translateY(-50%)` ,
137136 cursor : 'pointer' ,
138137 transition : `all ${ motionDurationSlow } ` ,
139138 pointerEvents : 'auto' ,
139+ userSelect : 'none' ,
140140
141141 '&:hover' : {
142142 background : operationBgHover . toRgbString ( ) ,
143143 } ,
144144
145145 [ `&-disabled` ] : {
146146 '&, &:hover' : {
147- color : imagePreviewOperationDisabledColor ,
147+ color : previewOperationColorDisabled ,
148148 background : 'transparent' ,
149149 cursor : 'not-allowed' ,
150150 [ `> ${ iconCls } ` ] : {
@@ -153,7 +153,7 @@ export const genPreviewSwitchStyle = (token: ImageToken): CSSObject => {
153153 } ,
154154 } ,
155155 [ `> ${ iconCls } ` ] : {
156- fontSize : token . imagePreviewOperationSize ,
156+ fontSize : token . previewOperationSize ,
157157 } ,
158158 } ,
159159
@@ -295,17 +295,11 @@ const genPreviewMotion: GenerateStyle<ImageToken> = token => {
295295export default genComponentStyleHook (
296296 'Image' ,
297297 token => {
298- const imagePreviewOperationColor = new TinyColor ( token . colorTextLightSolid ) ;
299298 const previewCls = `${ token . componentCls } -preview` ;
300299
301300 const imageToken = mergeToken < ImageToken > ( token , {
302301 previewCls,
303- imagePreviewOperationColor : imagePreviewOperationColor . toRgbString ( ) ,
304- imagePreviewOperationDisabledColor : new TinyColor ( imagePreviewOperationColor )
305- . setAlpha ( 0.25 )
306- . toRgbString ( ) ,
307302 modalMaskBg : new TinyColor ( '#000' ) . setAlpha ( 0.45 ) . toRgbString ( ) , // FIXME: Shared Token
308- imagePreviewOperationSize : token . fontSizeIcon * 1.5 , // FIXME: fontSizeIconLG
309303 imagePreviewSwitchSize : token . controlHeightLG ,
310304 } ) ;
311305
@@ -318,5 +312,10 @@ export default genComponentStyleHook(
318312 } ,
319313 token => ( {
320314 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
321320 } ) ,
322321) ;
0 commit comments