chore: update left nav icons

This commit is contained in:
zerosoul
2022-05-31 10:53:39 +08:00
parent dbffe6fb4b
commit 9906bebddf
15 changed files with 615 additions and 576 deletions
+30 -29
View File
@@ -1,8 +1,9 @@
// import { useRef, useEffect } from "react";
import { useRef, useEffect } from "react";
import styled from "styled-components";
import { Waveform } from "@uiball/loaders";
const Styled = styled.div`
margin-top: 80px;
display: flex;
justify-content: center;
align-items: center;
@@ -10,35 +11,35 @@ const Styled = styled.div`
padding: 30px 0;
/* background-color: #eee; */
`;
export default function LoadMore() {
// const ref = useRef(undefined);
// useEffect(() => {
// const observer = new IntersectionObserver(
// (entries) => {
// entries.forEach((entry) => {
// const intersecting = entry.isIntersecting;
// // const currEle = entry.target;
// if (intersecting && loadMore) {
// // load more
// console.log("inview");
// loadMore();
// }
// });
// },
// { threshold: 0 }
// );
// const currEle = ref?.current;
// if (currEle) {
// observer.observe(ref.current);
// }
// return () => {
// if (currEle) {
// observer.unobserve(currEle);
// }
// };
// }, [ref]);
export default function LoadMore({ pullDown = null }) {
const ref = useRef(undefined);
useEffect(() => {
const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
const intersecting = entry.isIntersecting;
// const currEle = entry.target;
if (intersecting && pullDown) {
// load more
console.log("inview");
pullDown();
}
});
},
{ threshold: 0 }
);
const currEle = ref?.current;
if (currEle) {
observer.observe(ref.current);
}
return () => {
if (currEle) {
observer.unobserve(currEle);
}
};
}, [ref, pullDown]);
return (
<Styled>
<Styled ref={ref}>
<Waveform
className="loading"
size={24}