1- import React , { useState , useCallback , CSSProperties } from 'react' ;
1+ import React , { useState , CSSProperties } from 'react' ;
22import { Icon , Modal } from '@gravity-ui/uikit' ;
33
44import { block } from '../../utils' ;
@@ -14,15 +14,18 @@ export interface FullScreenImageProps extends ImageProps {
1414}
1515
1616const b = block ( 'FullScreenImage' ) ;
17+ const FULL_SCREEN_ICON_SIZE = 18 ;
18+ const CLOSE_ICON_SIZE = 30 ;
1719
1820const FullScreenImage = ( props : FullScreenImageProps ) => {
1921 const { imageClassName, modalImageClass, imageStyle} = props ;
2022 const [ isOpened , setIsOpened ] = useState ( false ) ;
2123 const [ isMouseEnter , setIsMouseEnter ] = useState ( false ) ;
22- const openModal = useCallback ( ( ) => setIsOpened ( true ) , [ ] ) ;
23- const closeModal = useCallback ( ( ) => setIsOpened ( false ) , [ ] ) ;
24- const showFullScreenIcon = useCallback ( ( ) => setIsMouseEnter ( true ) , [ ] ) ;
25- const hideFullScreenIcon = useCallback ( ( ) => setIsMouseEnter ( false ) , [ ] ) ;
24+
25+ const openModal = ( ) => setIsOpened ( true ) ;
26+ const closeModal = ( ) => setIsOpened ( false ) ;
27+ const showFullScreenIcon = ( ) => setIsMouseEnter ( true ) ;
28+ const hideFullScreenIcon = ( ) => setIsMouseEnter ( false ) ;
2629
2730 return (
2831 < div className = { b ( ) } >
@@ -38,7 +41,12 @@ const FullScreenImage = (props: FullScreenImageProps) => {
3841 style = { imageStyle }
3942 />
4043 < div className = { b ( 'icon-wrapper' , { visible : isMouseEnter } ) } onClick = { openModal } >
41- < Icon data = { FullScreen } width = { 18 } height = { 18 } className = { b ( 'icon' ) } />
44+ < Icon
45+ data = { FullScreen }
46+ width = { FULL_SCREEN_ICON_SIZE }
47+ height = { FULL_SCREEN_ICON_SIZE }
48+ className = { b ( 'icon' ) }
49+ />
4250 </ div >
4351 </ div >
4452 { isOpened && (
@@ -47,8 +55,8 @@ const FullScreenImage = (props: FullScreenImageProps) => {
4755 < div className = { b ( 'icon-wrapper' , { visible : true } ) } onClick = { closeModal } >
4856 < Icon
4957 data = { PreviewClose }
50- width = { 30 }
51- height = { 30 }
58+ width = { CLOSE_ICON_SIZE }
59+ height = { CLOSE_ICON_SIZE }
5260 className = { b ( 'icon' , { hover : true } ) }
5361 />
5462 </ div >
0 commit comments