Skip to content

Commit

Permalink
feat(imageModal): Add fade-in
Browse files Browse the repository at this point in the history
  • Loading branch information
1ilsang committed Jun 11, 2024
1 parent 098a878 commit eb2e0c7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/features/shared/components/modal/ImageModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ImageModal: FunctionComponent<ImageModalProps> = () => {
</div>
)}
<img
className={classNames({ hidden: loading })}
className={classNames({ hidden: loading, 'fade-in': !loading })}
src={imageSrc}
ref={imageRef}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/features/shared/components/modal/useImageModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const useImageModal = () => {
}).then(() => {
setTimeout(() => {
setLoading(false);
}, 700);
}, 150);
});
};

Expand Down
16 changes: 15 additions & 1 deletion src/features/styles/modal/image.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
height: 30%;
animation:
skeleton-gradient 1.8s infinite ease-in-out,
spin 1.8s infinite ease-in-out;
spin 1s infinite ease-in-out;
}
}

Expand All @@ -63,5 +63,19 @@
.hidden {
visibility: hidden;
}

.fade-in {
@keyframes fade-in {
0% {
opacity: 0;
}

100% {
opacity: 1;
}
}

animation: fade-in 0.4s;
}
}
}

0 comments on commit eb2e0c7

Please sign in to comment.