+
Favoris
-
- {favorites.map(({ name, category }, key) => {
+
+ {favorites.map(({ name, link, category }, key) => {
const catName = categories.find(c => c.id === category).name;
return
- {name} - {catName}
+
+ {name} - {catName}
+
;
})}
-
+
Catégories
-
- {categories.map(({ id, name }, key) => (
- handleSelectCategory(id)}
- >
- {name} {id === categoryActive ? '(active)' : ''}
-
- ))}
+
+ {categories.map(({ id, name }, key) => {
+ const className = `${styles['item']} ${id === categoryActive ? styles['active'] : ''}`;
+ const onClick = () => handleSelectCategory(id);
+
+ return (
+
+ {name}
+
+ )
+ })}
+
+ Se connecter
+
);
}
\ No newline at end of file
diff --git a/components/Links/Link.js b/components/Links/Link.js
index f217585..864498f 100644
--- a/components/Links/Link.js
+++ b/components/Links/Link.js
@@ -1,28 +1,11 @@
-import { useEffect, useCallback } from 'react';
-import { useInView } from 'react-intersection-observer';
-
import styles from '../../styles/links.module.scss';
-export default function Link({ category, setCategoryActive, refCategoryActive }) {
- const { ref, inView } = useInView({ threshold: .5 });
- const { id, name, links, ref: refCategory } = category;
-
- useEffect(() => inView ? setCategoryActive(id) : null, [id, inView, setCategoryActive]);
-
- const setRefs = useCallback((node) => {
- refCategory.current = node;
- refCategoryActive.current = node;
- ref(node);
- }, [ref, refCategoryActive, refCategory]);
-
+export default function Link({ link }) {
return (
-
-
{name}
-
- {links.map(({ name }, key2) => (
- {name}
- ))}
-
-
+
+
+ {link?.name} {link?.link}
+
+
);
}
\ No newline at end of file
diff --git a/components/Links/LinkBlock.js b/components/Links/LinkBlock.js
new file mode 100644
index 0000000..8733764
--- /dev/null
+++ b/components/Links/LinkBlock.js
@@ -0,0 +1,30 @@
+import { useEffect, useCallback } from 'react';
+import { useInView } from 'react-intersection-observer';
+
+import Link from './Link';
+
+import styles from '../../styles/links.module.scss';
+
+export default function LinkBlock({ category, setCategoryActive, refCategoryActive }) {
+ const { ref, inView } = useInView({ threshold: .5 });
+ const { id, name, links, ref: refCategory } = category;
+
+ useEffect(() => inView ? setCategoryActive(id) : null, [id, inView, setCategoryActive]);
+
+ const setRefs = useCallback((node) => {
+ refCategory.current = node;
+ refCategoryActive.current = node;
+ ref(node);
+ }, [ref, refCategoryActive, refCategory]);
+
+ return (
+
+
{name}
+
+ {links.map((link, key2) => (
+
+ ))}
+
+
+ );
+}
\ No newline at end of file
diff --git a/components/Links/Links.js b/components/Links/Links.js
index 0fc4f0a..b487616 100644
--- a/components/Links/Links.js
+++ b/components/Links/Links.js
@@ -1,11 +1,11 @@
-import Link from './Link';
+import LinkBlock from './LinkBlock';
import styles from '../../styles/links.module.scss';
export default function Links({ categories, setCategoryActive, refCategoryActive }) {
return (
{categories.map((category, key) => (
- a {
+ color: #3f88c5;
+ text-decoration: none;
+ padding: 10px 15px;
+ border: 1px solid #dadce0;
+ border-bottom: 2px solid #dadce0;
+ border-radius: 3px;
+ margin-bottom: 10px;
+ display: flex;
+ flex-direction: column;
+ transition: .15s;
+
+ &:hover {
+ border-bottom-color: #3f88c5;
+ transform: scale(1.01);
+ }
+
+ & .link-url {
+ color: #bbb;
+ font-size: .80em;
+ }
+ }
+ }
}
}
\ No newline at end of file