Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix svg fullscreen #1562

Merged
merged 3 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ui/shared/nft/NftHtmlFullscreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Props {
onClose: () => void;
}

const NftHtmlWithFullscreen = ({ src, isOpen, onClose }: Props) => {
const NftHtmlFullscreen = ({ src, isOpen, onClose }: Props) => {
return (
<NftMediaFullscreenModal isOpen={ isOpen } onClose={ onClose }>
<chakra.iframe
Expand All @@ -22,4 +22,4 @@ const NftHtmlWithFullscreen = ({ src, isOpen, onClose }: Props) => {
);
};

export default NftHtmlWithFullscreen;
export default NftHtmlFullscreen;
33 changes: 0 additions & 33 deletions ui/shared/nft/NftHtmlWithFullscreen.tsx

This file was deleted.

23 changes: 20 additions & 3 deletions ui/shared/nft/NftImageFullscreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,29 @@ interface Props {
onClose: () => void;
}

const NftImageWithFullscreen = ({ src, isOpen, onClose }: Props) => {
const NftImageFullscreen = ({ src, isOpen, onClose }: Props) => {
const imgRef = React.useRef<HTMLImageElement>(null);
const [ hasDimentions, setHasDimentions ] = React.useState<boolean>(true);

const checkWidth = React.useCallback(() => {
if (imgRef.current?.getBoundingClientRect().width === 0) {
setHasDimentions(false);
}
}, [ ]);

return (
<NftMediaFullscreenModal isOpen={ isOpen } onClose={ onClose }>
<Image src={ src } alt="Token instance image" maxH="90vh" maxW="90vw"/>
<Image
src={ src }
alt="Token instance image"
maxH="90vh"
maxW="90vw"
ref={ imgRef }
onLoad={ checkWidth }
sx={ hasDimentions ? {} : { width: '90vw', height: '90vh' } }
/>
</NftMediaFullscreenModal>
);
};

export default NftImageWithFullscreen;
export default NftImageFullscreen;
29 changes: 0 additions & 29 deletions ui/shared/nft/NftImageWithFullscreen.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions ui/shared/nft/NftVideoFullscreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface Props {
onClose: () => void;
}

const NftVideoWithFullscreen = ({ src, isOpen, onClose }: Props) => {
const NftVideoFullscreen = ({ src, isOpen, onClose }: Props) => {
return (
<NftMediaFullscreenModal isOpen={ isOpen } onClose={ onClose }>
<chakra.video
Expand All @@ -23,4 +23,4 @@ const NftVideoWithFullscreen = ({ src, isOpen, onClose }: Props) => {
);
};

export default NftVideoWithFullscreen;
export default NftVideoFullscreen;
37 changes: 0 additions & 37 deletions ui/shared/nft/NftVideoWithFullscreen.tsx

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading