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

35 lines
900 B
TypeScript
Raw Normal View History

2023-12-15 21:25:39 -06:00
import {
CollectionIncludingMembersAndLinkCount,
LinkIncludingShortenedCollectionAndTags,
} from "@/types/global";
2024-03-10 05:08:28 -05:00
import Link from "next/link";
2023-12-15 21:25:39 -06:00
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 (
2024-03-10 05:08:28 -05:00
<Link
href={`/collections/${link.collection.id}`}
2023-12-15 21:25:39 -06:00
onClick={(e) => {
2024-03-10 05:08:28 -05:00
e.stopPropagation();
2023-12-15 21:25:39 -06:00
}}
2024-03-10 05:08:28 -05:00
className="flex items-center gap-1 max-w-full w-fit hover:opacity-70 duration-100 select-none"
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>
2024-03-10 05:08:28 -05:00
</Link>
2023-12-15 21:25:39 -06:00
);
}