Add new hero carousel and start working on cards #153
This commit is contained in:
13 files changed
+355
-916
No files matched your search
@@ -0,0 +1,24 @@
|
||||
/** @format */
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
|
||||
const useIntersecting = (ref) => {
|
||||
const [isIntersecting, setIntersecting] = useState(false);
|
||||
|
||||
const observer = useMemo(
|
||||
() =>
|
||||
new IntersectionObserver(([entry]) =>
|
||||
setIntersecting(entry.isIntersecting),
|
||||
),
|
||||
[ref],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
observer.observe(ref.current);
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
|
||||
return isIntersecting;
|
||||
};
|
||||
|
||||
export default useIntersecting;
|
||||
@@ -0,0 +1,8 @@
|
||||
/** @format */
|
||||
|
||||
import { create } from "zustand";
|
||||
|
||||
export const useCarouselStore = create((set) => ({
|
||||
direction: "right",
|
||||
setDirection: (dir) => set(() => ({ direction: dir })),
|
||||
}));
|
||||
Reference in new issue
Block a user