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 ? (
-
- {links.map((link, key) => (
-
+
+ {links.map((link, index) => (
+
))}
) : (
-
- Aucun lien pour {name}
-
+
+
+ Aucun lien pour {name}
+
+
Créer un lien
diff --git a/src/components/Links/links.module.scss b/src/components/Links/links.module.scss
index 6bdfe2b..20c0bb7 100644
--- a/src/components/Links/links.module.scss
+++ b/src/components/Links/links.module.scss
@@ -71,7 +71,6 @@
gap: 0.5em;
padding: 3px;
flex-direction: column;
- animation: fadein 0.3s both; // bug on drag start
overflow-x: hidden;
overflow-y: scroll;
}
@@ -89,7 +88,6 @@
outline: 3px solid transparent;
display: flex;
align-items: center;
- transition: 0.15s;
&:hover {
border: 1px solid transparent;
diff --git a/src/components/SideMenu/Categories/Categories.tsx b/src/components/SideMenu/Categories/Categories.tsx
index b85ba3e..989af52 100644
--- a/src/components/SideMenu/Categories/Categories.tsx
+++ b/src/components/SideMenu/Categories/Categories.tsx
@@ -22,12 +22,13 @@ export default function Categories({
Catégories • {linksCount}
- {categories.map((category, key) => (
+ {categories.map((category, index) => (
))}
diff --git a/src/components/SideMenu/Categories/CategoryItem.tsx b/src/components/SideMenu/Categories/CategoryItem.tsx
index 16f7a70..1e400ac 100644
--- a/src/components/SideMenu/Categories/CategoryItem.tsx
+++ b/src/components/SideMenu/Categories/CategoryItem.tsx
@@ -3,18 +3,21 @@ import { AiFillFolderOpen, AiOutlineFolder } from "react-icons/ai";
import { Category } from "types";
+import { motion } from "framer-motion";
import styles from "./categories.module.scss";
interface CategoryItemProps {
category: Category;
categoryActive: Category;
handleSelectCategory: (category: Category) => void;
+ index: number;
}
export default function CategoryItem({
category,
categoryActive,
handleSelectCategory,
+ index,
}: CategoryItemProps): JSX.Element {
const ref = useRef
();
const className = `${styles["item"]} ${
@@ -29,11 +32,25 @@ export default function CategoryItem({
}, [category.id, categoryActive.id]);
return (
- -
{category.id === categoryActive.id ? (
@@ -45,6 +62,6 @@ export default function CategoryItem({
{category.name}
— {category.links.length}
-
+
);
}
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 8d1173f..9c51a95 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -9,6 +9,7 @@ import SearchModal from "components/SearchModal/SearchModal";
import SideMenu from "components/SideMenu/SideMenu";
import * as Keys from "constants/keys";
+import { motion } from "framer-motion";
import { Category, Link, SearchItem } from "types";
import { prisma } from "utils/back";
import { BuildCategory } from "utils/front";
@@ -155,7 +156,16 @@ function Home(props: HomeProps) {
);
return (
-
+
)}
-
+
);
}
diff --git a/src/styles/globals.scss b/src/styles/globals.scss
index 85d7d0a..332c460 100644
--- a/src/styles/globals.scss
+++ b/src/styles/globals.scss
@@ -34,7 +34,6 @@ body {
padding: 10px;
display: flex;
justify-content: center;
- animation: fadein 250ms both;
}
a {