mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-10 07:25:35 +00:00
feat; add quick actions + change icons
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import LinkTag from "next/link";
|
||||
|
||||
import { Category } from "types";
|
||||
|
||||
import EditItem from "components/QuickActions/EditItem";
|
||||
import RemoveItem from "components/QuickActions/RemoveItem";
|
||||
import LinkItem from "./LinkItem";
|
||||
|
||||
import styles from "./links.module.scss";
|
||||
@@ -15,25 +18,29 @@ export default function Links({ category }: { category: Category }) {
|
||||
);
|
||||
}
|
||||
|
||||
const { name, links } = category;
|
||||
const { id, name, links } = category;
|
||||
if (links.length === 0) {
|
||||
return (
|
||||
<div className={styles["no-link"]}>
|
||||
<p>
|
||||
Aucun lien pour <b>{category.name}</b>
|
||||
Aucun lien pour <b>{name}</b>
|
||||
</p>
|
||||
<LinkTag href={`/link/create?categoryId=${category.id}`}>
|
||||
Créer un lien
|
||||
</LinkTag>
|
||||
<LinkTag href={`/link/create?categoryId=${id}`}>Créer un lien</LinkTag>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles["links-wrapper"]}>
|
||||
<h2>
|
||||
{name}
|
||||
<span className={styles["links-count"]}> — {links.length}</span>
|
||||
<h2 className={styles["category-header"]}>
|
||||
<span>
|
||||
{name}
|
||||
<span className={styles["links-count"]}> — {links.length}</span>
|
||||
</span>
|
||||
<span className={styles["category-controls"]}>
|
||||
<EditItem type="category" id={id} />
|
||||
<RemoveItem type="category" id={id} />
|
||||
</span>
|
||||
</h2>
|
||||
<ul className={styles["links"]} key={Math.random()}>
|
||||
{links.map((link, key) => (
|
||||
|
||||
Reference in New Issue
Block a user