Skip to content

Commit

Permalink
fix: imageProps in FullscreenImage
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmch authored and Kezhik Kyzyl-ool committed Jan 30, 2024
1 parent b7c6d1c commit ca3bec1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/FullscreenImage/FullscreenImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import i18n from './i18n';

import './FullscreenImage.scss';

export interface FullscreenImageProps extends ImageProps {
export interface FullscreenImageProps extends Omit<ImageProps, 'extraProps'> {
imageClassName?: string;
modalImageClass?: string;
imageStyle?: CSSProperties;
Expand All @@ -22,7 +22,8 @@ const FULL_SCREEN_ICON_SIZE = 18;
const CLOSE_ICON_SIZE = 30;

const FullscreenImage = (props: FullscreenImageProps) => {
const {imageClassName, modalImageClass, imageStyle, alt = i18n('img-alt'), extraProps} = props;
const {imageClassName, modalImageClass, imageStyle, alt = i18n('img-alt')} = props;
const {extraProps, ...imageProps} = props;
const [isOpened, setIsOpened] = useState(false);

const openModal = () => setIsOpened(true);
Expand All @@ -32,7 +33,7 @@ const FullscreenImage = (props: FullscreenImageProps) => {
<div className={b()} {...extraProps}>
<div className={b('image-wrapper')}>
<Image
{...props}
{...imageProps}
alt={alt}
className={b('image', imageClassName)}
onClick={openModal}
Expand Down Expand Up @@ -62,7 +63,7 @@ const FullscreenImage = (props: FullscreenImageProps) => {
className={b('icon', {hover: true})}
/>
</button>
<Image {...props} className={b('modal-image', modalImageClass)} />
<Image {...imageProps} className={b('modal-image', modalImageClass)} />
</div>
</Modal>
)}
Expand Down

0 comments on commit ca3bec1

Please sign in to comment.