Image tags are fucked for right now.
Cart is working
This commit is contained in:
@ -10,10 +10,7 @@ class IntersectionObserverManager {
|
||||
constructor(options: IntersectionObserverInit) {
|
||||
this.callbacks = new Map();
|
||||
|
||||
this.observer = new IntersectionObserver(
|
||||
this.handleIntersect.bind(this),
|
||||
options,
|
||||
);
|
||||
this.observer = new IntersectionObserver(this.handleIntersect.bind(this), options);
|
||||
}
|
||||
|
||||
private handleIntersect(entries: IntersectionObserverEntry[]) {
|
||||
|
||||
@ -8,9 +8,7 @@ interface UseInViewOptions extends IntersectionObserverInit {
|
||||
triggerOnce?: boolean;
|
||||
}
|
||||
|
||||
const useInView = (
|
||||
options: UseInViewOptions,
|
||||
): [RefObject<HTMLImageElement>, boolean] => {
|
||||
const useInView = (options: UseInViewOptions): [RefObject<HTMLImageElement>, boolean] => {
|
||||
const [isInView, setIsInView] = useState<boolean>(false);
|
||||
const elementRef = useRef<HTMLImageElement>(null);
|
||||
const observerManager = useSharedIntersectionObserver(options);
|
||||
@ -18,9 +16,7 @@ const useInView = (
|
||||
const element = elementRef.current;
|
||||
if (!element) return;
|
||||
|
||||
const prefersReducedMotion = window.matchMedia(
|
||||
'(prefers-reduced-motion: reduce)',
|
||||
);
|
||||
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
|
||||
if (prefersReducedMotion.matches) {
|
||||
setIsInView(true);
|
||||
if (options.triggerOnce) {
|
||||
|
||||
@ -19,18 +19,14 @@ const useInView = (
|
||||
: Array.isArray(threshold) && threshold.every((t) => t >= 0 && t <= 1);
|
||||
|
||||
if (!isValidThreshold) {
|
||||
console.warn(
|
||||
'Invalid threshold value passed to useInView. It should be between 0 and 1.',
|
||||
);
|
||||
console.warn('Invalid threshold value passed to useInView. It should be between 0 and 1.');
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const element = ref.current;
|
||||
if (!element) return;
|
||||
|
||||
const prefersReducedMotion = window.matchMedia(
|
||||
'(prefers-reduced-motion: reduce)',
|
||||
);
|
||||
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
|
||||
if (prefersReducedMotion.matches) {
|
||||
setIsVisible(true);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user