diff --git a/package-lock.json b/package-lock.json index 1e91ee0..d0225b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "@prisma/client": "^4.14.0", "@svgr/webpack": "^8.0.1", "axios": "^1.4.0", + "framer-motion": "^10.12.12", "next": "^13.4.2", "next-auth": "^4.22.1", "next-seo": "^6.0.0", @@ -1763,6 +1764,21 @@ "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.0.tgz", "integrity": "sha512-14FtKiHhy2QoPIzdTcvh//8OyBlknNs2nXRwIhG904opCby3l+9Xaf/wuPvICBF0rc1ZCNBd3nKe9cd2mecVkQ==" }, + "node_modules/@emotion/is-prop-valid": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz", + "integrity": "sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==", + "optional": true, + "dependencies": { + "@emotion/memoize": "0.7.4" + } + }, + "node_modules/@emotion/is-prop-valid/node_modules/@emotion/memoize": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz", + "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==", + "optional": true + }, "node_modules/@emotion/memoize": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.0.tgz", @@ -4280,6 +4296,29 @@ "node": ">= 6" } }, + "node_modules/framer-motion": { + "version": "10.12.12", + "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-10.12.12.tgz", + "integrity": "sha512-DDCqp60U6hR7aUrXj/BXc/t0Sd/U4ep6w/NZQkw898K+u7s+Vv/P8yxq4WTNA86kU9QCsqOgn1Qhz2DpYK0Oag==", + "dependencies": { + "tslib": "^2.4.0" + }, + "optionalDependencies": { + "@emotion/is-prop-valid": "^0.8.2" + }, + "peerDependencies": { + "react": "^18.0.0", + "react-dom": "^18.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", diff --git a/package.json b/package.json index 923690a..b33bb09 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "@prisma/client": "^4.14.0", "@svgr/webpack": "^8.0.1", "axios": "^1.4.0", + "framer-motion": "^10.12.12", "next": "^13.4.2", "next-auth": "^4.22.1", "next-seo": "^6.0.0", diff --git a/src/components/Links/LinkItem.tsx b/src/components/Links/LinkItem.tsx index 6c022f3..7a50027 100644 --- a/src/components/Links/LinkItem.tsx +++ b/src/components/Links/LinkItem.tsx @@ -1,4 +1,5 @@ import axios from "axios"; +import { motion } from "framer-motion"; import LinkTag from "next/link"; import { AiFillStar } from "react-icons/ai"; @@ -14,9 +15,11 @@ import styles from "./links.module.scss"; export default function LinkItem({ link, toggleFavorite, + index, }: { link: Link; toggleFavorite: (linkId: Link["id"]) => void; + index: number; }) { const { id, name, url, favorite } = link; const onFavorite = () => { @@ -33,7 +36,18 @@ export default function LinkItem({ }; return ( -
  • + @@ -46,7 +60,7 @@ export default function LinkItem({ -
  • + ); } diff --git a/src/components/Links/Links.tsx b/src/components/Links/Links.tsx index 07f07e2..5faf4ea 100644 --- a/src/components/Links/Links.tsx +++ b/src/components/Links/Links.tsx @@ -6,6 +6,7 @@ import EditItem from "components/QuickActions/EditItem"; import RemoveItem from "components/QuickActions/RemoveItem"; import LinkItem from "./LinkItem"; +import { AnimatePresence, motion } from "framer-motion"; import styles from "./links.module.scss"; export default function Links({ @@ -40,16 +41,32 @@ export default function Links({ {links.length !== 0 ? ( -