From 6fb096b8c45abe1fc4e28292d9807048e0294bd2 Mon Sep 17 00:00:00 2001 From: Ou Date: Sat, 12 Oct 2024 23:23:29 +0800 Subject: [PATCH] chore: cleanup deps --- package.json | 4 +--- pnpm-lock.yaml | 18 ------------------ src/components/section/card.tsx | 5 ++--- src/styles/globals.css | 1 - 4 files changed, 3 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index b366914..18e4cdd 100644 --- a/package.json +++ b/package.json @@ -46,9 +46,7 @@ "overlayscrollbars-react": "^0.5.6", "react": "^18.3.1", "react-dom": "^18.3.1", - "react-intersection-observer": "^9.13.1", - "react-use": "^17.5.1", - "zod": "^3.23.8" + "react-use": "^17.5.1" }, "devDependencies": { "@eslint-react/eslint-plugin": "^1.14.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 11f760f..4be2879 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,9 +86,6 @@ importers: react-dom: specifier: ^18.3.1 version: 18.3.1(react@18.3.1) - react-intersection-observer: - specifier: ^9.13.1 - version: 9.13.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-use: specifier: ^17.5.1 version: 17.5.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -4097,15 +4094,6 @@ packages: peerDependencies: react: ^18.3.1 - react-intersection-observer@9.13.1: - resolution: {integrity: sha512-tSzDaTy0qwNPLJHg8XZhlyHTgGW6drFKTtvjdL+p6um12rcnp8Z5XstE+QNBJ7c64n5o0Lj4ilUleA41bmDoMw==} - peerDependencies: - react: ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 - react-dom: ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 - peerDependenciesMeta: - react-dom: - optional: true - react-universal-interface@0.6.2: resolution: {integrity: sha512-dg8yXdcQmvgR13RIlZbTRQOoUrDciFVoSBZILwjE2LFISxZZ8loVJKAkuzswl5js8BHda79bIb2b84ehU8IjXw==} peerDependencies: @@ -9127,12 +9115,6 @@ snapshots: react: 18.3.1 scheduler: 0.23.2 - react-intersection-observer@9.13.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1): - dependencies: - react: 18.3.1 - optionalDependencies: - react-dom: 18.3.1(react@18.3.1) - react-universal-interface@0.6.2(react@18.3.1)(tslib@2.7.0): dependencies: react: 18.3.1 diff --git a/src/components/section/card.tsx b/src/components/section/card.tsx index 6dc0434..c75cbb7 100644 --- a/src/components/section/card.tsx +++ b/src/components/section/card.tsx @@ -2,7 +2,7 @@ import type { NewsItem, SourceID, SourceInfo, SourceResponse } from "@shared/typ import type { UseQueryResult } from "@tanstack/react-query" import { useQuery } from "@tanstack/react-query" import clsx from "clsx" -import { useInView } from "react-intersection-observer" +import { useInView } from "framer-motion" import { useAtom } from "jotai" import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from "react" import { sources } from "@shared/sources" @@ -33,10 +33,9 @@ interface Query { export const CardWrapper = forwardRef(({ id, isDragged, handleListeners, style, ...props }, dndRef) => { const ref = useRef(null) - const { ref: inViewRef, inView } = useInView() + const inView = useInView(ref) useImperativeHandle(dndRef, () => ref.current!) - useImperativeHandle(inViewRef, () => ref.current!) return (