Skip to content

Commit

Permalink
#93 frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
fdhhhdjd committed Nov 4, 2022
1 parent 394c714 commit 6a0cbcb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
14 changes: 14 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"react-helmet-async": "^1.3.0",
"react-hot-toast": "^2.2.0",
"react-icons": "^4.3.1",
"react-lazy-load-image-component": "^1.5.5",
"react-paypal-express-checkout": "^1.0.5",
"react-phone-number-input": "^3.1.50",
"react-redux": "^7.2.6",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import "react-phone-number-input/style.css";
import { Provider } from "react-redux";
import { BrowserRouter as Router } from "react-router-dom";
import "react-toastify/dist/ReactToastify.css";
import "react-lazy-load-image-component/src/effects/blur.css";
import "react-lazy-load-image-component/src/effects/opacity.css";
import App from "./App";
import "./index.css";
import reportWebVitals from "./reportWebVitals";
Expand Down
18 changes: 14 additions & 4 deletions frontend/src/v1/user_ui/custom_hook/Lazy_Load_Img.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { useEffect, useRef } from "react";
const Lazy_Load_Img = ({ url, style }) => {
import { LazyLoadImage, trackWindowScroll } from "react-lazy-load-image-component";
import { comment_png } from "../imports/Assets_Import"
const Lazy_Load_Img = ({ url, style, scrollPosition }) => {
const imgRef = useRef();
useEffect(() => {
const img = imgRef.current;
Expand All @@ -19,7 +21,7 @@ const Lazy_Load_Img = ({ url, style }) => {

return (
<React.Fragment>
{style ? (
{/* {style ? (
<img
alt="...loading"
ref={imgRef}
Expand All @@ -28,9 +30,17 @@ const Lazy_Load_Img = ({ url, style }) => {
/>
) : (
<img alt="...loading" ref={imgRef} className="lazy-load" />
)}
)} */}
<LazyLoadImage
src={url}
PlaceholderSrc={comment_png}
effect="opacity"
alt={url}
placeholderSrc={url}
scrollPosition={scrollPosition}
/>
</React.Fragment>
);
};

export default Lazy_Load_Img;
export default trackWindowScroll(Lazy_Load_Img);

0 comments on commit 6a0cbcb

Please sign in to comment.