el.xwx.moe/pages/collections/[id].tsx

25 lines
636 B
TypeScript
Raw Normal View History

2023-03-05 15:03:20 -06:00
import LinkList from "@/components/LinkList";
2023-03-22 18:11:54 -05:00
import useLinkStore from "@/store/links";
import { useRouter } from "next/router";
export default function () {
const router = useRouter();
2023-03-22 18:11:54 -05:00
const { links } = useLinkStore();
2023-03-05 15:03:20 -06:00
const linksByCollection = links.filter(
(e) => e.collectionId === Number(router.query.id)
);
2023-03-05 15:03:20 -06:00
return (
// ml-80
2023-03-25 09:17:34 -05:00
<div className="p-2">
<p className="text-right mb-2 text-gray-500 font-bold text-sm">
2023-03-05 15:03:20 -06:00
{linksByCollection.length || 0} Links Found
</p>
{linksByCollection.map((e, i) => {
return <LinkList key={i} link={e} count={i} />;
})}
</div>
);
}