2024-08-20 18:25:35 -05:00
|
|
|
import Icon from "@/components/Icon";
|
2023-12-15 21:25:39 -06:00
|
|
|
import {
|
|
|
|
CollectionIncludingMembersAndLinkCount,
|
|
|
|
LinkIncludingShortenedCollectionAndTags,
|
|
|
|
} from "@/types/global";
|
2024-08-20 18:25:35 -05:00
|
|
|
import { IconWeight } from "@phosphor-icons/react";
|
2024-03-10 05:08:28 -05:00
|
|
|
import Link from "next/link";
|
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;
|
|
|
|
}) {
|
|
|
|
return (
|
2024-08-12 23:08:57 -05:00
|
|
|
<>
|
|
|
|
<Link
|
|
|
|
href={`/collections/${link.collection.id}`}
|
|
|
|
onClick={(e) => {
|
|
|
|
e.stopPropagation();
|
|
|
|
}}
|
|
|
|
className="flex items-center gap-1 max-w-full w-fit hover:opacity-70 duration-100 select-none"
|
|
|
|
title={collection?.name}
|
|
|
|
>
|
2024-08-20 18:25:35 -05:00
|
|
|
{link.collection.icon ? (
|
|
|
|
<Icon
|
|
|
|
icon={link.collection.icon}
|
|
|
|
size={20}
|
|
|
|
weight={(link.collection.iconWeight || "regular") as IconWeight}
|
2024-08-30 01:38:58 -05:00
|
|
|
color={link.collection.color}
|
2024-08-20 18:25:35 -05:00
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<i
|
|
|
|
className="bi-folder-fill text-lg"
|
2024-08-30 01:38:58 -05:00
|
|
|
style={{ color: link.collection.color }}
|
2024-08-20 18:25:35 -05:00
|
|
|
></i>
|
|
|
|
)}
|
2024-08-12 23:08:57 -05:00
|
|
|
<p className="truncate capitalize">{collection?.name}</p>
|
|
|
|
</Link>
|
|
|
|
</>
|
2023-12-15 21:25:39 -06:00
|
|
|
);
|
|
|
|
}
|