Skip to content

Commit

Permalink
feat(ImgLoader): set position to be handled when aspect ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
aneurysmjs committed Jun 3, 2019
1 parent c47cb33 commit 7ac1080
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/components/shared/ImgLoader/ImgLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ function ImgLoader({ src, onError }: PropsType) {
}, [src, image, onError]);

return (
imgObj.isLoading ? (<Spinner />) : (<img className="imgLoader img-fluid" src={imgObj.img} alt="img" />)
imgObj.isLoading ? (
<span className="imgLoader__spinner">
<Spinner />
</span>
) : (<img className="imgLoader" src={imgObj.img} alt="img" />)
);
}

Expand Down
13 changes: 13 additions & 0 deletions src/app/components/shared/ImgLoader/ImgLoader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
@import '~styles/mixins';
@import '~styles/variables';

$pos: calc(50% - 24px);

.imgLoader {
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}

.imgLoader__spinner {
left: $pos;
position: absolute;
right: 0;
top: $pos;
}

0 comments on commit 7ac1080

Please sign in to comment.