Skip to content
This repository has been archived by the owner on Aug 30, 2020. It is now read-only.

Commit

Permalink
fix: eslint format
Browse files Browse the repository at this point in the history
  • Loading branch information
irfan-maulana-tkp committed Aug 10, 2020
1 parent ffff81b commit a302d72
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
14 changes: 7 additions & 7 deletions client/components/LazyImage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ const optionsData = {
const LazyImage = ({ alt, src, style, width, height }) => {
const placeholder = `https://res.cloudinary.com/irfan-maulana-tkpd/image/fetch/c_fill,g_auto:face,h_50,fl_force_strip.progressive/f_webp/${encodeURIComponent(
'https://res.cloudinary.com/irfan-maulana-tkpd/image/upload/v1597041453/placeholder_qzxxc6.png',
)}`;
)}`;

const [showSrc, setShowSrc] = useState(placeholder);
const [loaded, setLoaded] = useState(false);

const onIntersect = () => {
const imgObj = new Image();
imgObj.onload = () => {
setLoaded(true);
}
imgObj.src = src;
setShowSrc(src);
const imgObj = new Image();
imgObj.onload = () => {
setLoaded(true);
};
imgObj.src = src;
setShowSrc(src);
};

const targetRef = useIntersect(onIntersect, optionsData, true);
Expand Down
8 changes: 5 additions & 3 deletions client/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ code {
}

.img {
transition: filter .5s linear;
transition: filter .5s linear;
}

.img.img--loading {
filter: blur(1px);
filter: blur(1px);
}

.img.img--loaded {
filter: blur(0);
filter: blur(0);
}

0 comments on commit a302d72

Please sign in to comment.