2023-12-21 04:08:56 -06:00
|
|
|
import LinkCard from "@/components/LinkViews/LinkCard";
|
2023-12-15 21:25:39 -06:00
|
|
|
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
|
2024-03-10 05:08:28 -05:00
|
|
|
import { link } from "fs";
|
|
|
|
import { GridLoader } from "react-spinners";
|
2023-12-15 21:25:39 -06:00
|
|
|
|
2023-12-21 04:11:26 -06:00
|
|
|
export default function CardView({
|
2023-12-15 21:25:39 -06:00
|
|
|
links,
|
2024-02-11 01:29:11 -06:00
|
|
|
editMode,
|
2024-03-10 05:08:28 -05:00
|
|
|
isLoading,
|
2023-12-15 21:25:39 -06:00
|
|
|
}: {
|
|
|
|
links: LinkIncludingShortenedCollectionAndTags[];
|
2024-02-10 23:55:00 -06:00
|
|
|
editMode?: boolean;
|
2024-03-10 05:08:28 -05:00
|
|
|
isLoading?: boolean;
|
2023-12-15 21:25:39 -06:00
|
|
|
}) {
|
|
|
|
return (
|
2023-12-23 18:00:53 -06:00
|
|
|
<div className="grid min-[1900px]:grid-cols-4 xl:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-5">
|
2023-12-15 21:25:39 -06:00
|
|
|
{links.map((e, i) => {
|
2024-01-19 23:34:49 -06:00
|
|
|
return (
|
|
|
|
<LinkCard
|
|
|
|
key={i}
|
|
|
|
link={e}
|
|
|
|
count={i}
|
|
|
|
flipDropdown={i === links.length - 1}
|
2024-02-10 23:55:00 -06:00
|
|
|
editMode={editMode}
|
2024-01-19 23:34:49 -06:00
|
|
|
/>
|
|
|
|
);
|
2023-12-15 21:25:39 -06:00
|
|
|
})}
|
2024-03-10 05:08:28 -05:00
|
|
|
|
|
|
|
{isLoading && links.length > 0 && (
|
|
|
|
<GridLoader
|
|
|
|
color="oklch(var(--p))"
|
|
|
|
loading={true}
|
|
|
|
size={20}
|
|
|
|
className="fixed top-5 right-5 opacity-50 z-30"
|
|
|
|
/>
|
|
|
|
)}
|
2023-12-15 21:25:39 -06:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|