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

35 lines
950 B
TypeScript
Raw Normal View History

2023-12-15 21:25:39 -06:00
import {
CollectionIncludingMembersAndLinkCount,
LinkIncludingShortenedCollectionAndTags,
} from "@/types/global";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faFolder } from "@fortawesome/free-solid-svg-icons";
import { useRouter } from "next/router";
export default function LinkCollection({
link,
collection,
}: {
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"
>
<FontAwesomeIcon
icon={faFolder}
2023-12-16 14:06:26 -06:00
className="w-4 h-4 shadow"
2023-12-15 21:25:39 -06:00
style={{ color: collection?.color }}
/>
<p className="truncate capitalize">{collection?.name}</p>
</div>
);
}