el.xwx.moe/components/LinkViews/LinkComponents/LinkCollection.tsx

34 lines
865 B
TypeScript
Raw Normal View History

2023-12-15 21:25:39 -06:00
import {
CollectionIncludingMembersAndLinkCount,
LinkIncludingShortenedCollectionAndTags,
} from "@/types/global";
import { useRouter } from "next/router";
2023-12-17 02:30:09 -06:00
import React from "react";
2023-12-15 21:25:39 -06:00
2023-12-17 22:32:33 -06:00
export default function LinkCollection({
link,
collection,
}: {
2023-12-15 21:25:39 -06:00
link: LinkIncludingShortenedCollectionAndTags;
collection: CollectionIncludingMembersAndLinkCount;
}) {
const router = useRouter();
return (
<div
onClick={(e) => {
2023-12-16 14:06:26 -06:00
e.stopPropagation();
2023-12-15 21:25:39 -06:00
router.push(`/collections/${link.collection.id}`);
}}
className="flex items-center gap-1 max-w-full w-fit hover:opacity-70 duration-100"
2023-12-23 18:00:53 -06:00
title={collection?.name}
2023-12-15 21:25:39 -06:00
>
2023-12-17 22:32:33 -06:00
<i
className="bi-folder-fill text-lg drop-shadow"
style={{ color: collection?.color }}
></i>
2023-12-15 21:25:39 -06:00
<p className="truncate capitalize">{collection?.name}</p>
</div>
);
}