From a302d72867e80f6ea830a89fe8f7fa8c576c9fe0 Mon Sep 17 00:00:00 2001 From: Irfan Maulana Date: Mon, 10 Aug 2020 14:26:09 +0700 Subject: [PATCH] fix: eslint format --- client/components/LazyImage/index.js | 14 +++++++------- client/styles/index.scss | 8 +++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/client/components/LazyImage/index.js b/client/components/LazyImage/index.js index b6059cd..3ade7af 100644 --- a/client/components/LazyImage/index.js +++ b/client/components/LazyImage/index.js @@ -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); diff --git a/client/styles/index.scss b/client/styles/index.scss index 97fddce..b9e2035 100644 --- a/client/styles/index.scss +++ b/client/styles/index.scss @@ -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); }