import { Download } from "lucide-react";
import { pluginCardScreenshot } from "./thumbnails";
import { pluginHref } from "./links";
import { PluginTile } from "./plugin-tile";
import { formatInstalls, getCategory, type Plugin } from "./registry";
export const PLUGIN_GRID_CLASS =
"grid gap-x-4 gap-y-8 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4";
/** First screenshot, or the plugin tile on a quiet backdrop when there is none. */
function PluginShot({ plugin }: { plugin: Plugin }) {
const url = plugin.screenshots[0];
return (
{url ? (
![]()
) : (
)}
);
}
/** What's new card: screenshot, name, and when it was added. */
export function NewPluginCard({ plugin, added }: { plugin: Plugin; added: string }) {
return (
{plugin.name}
Added {added}
);
}
/** Grid card: screenshot, name, one muted stat, and a two-line description. */
export function PluginCard({
plugin,
installs,
added,
}: {
plugin: Plugin;
/** Shown with a download icon; otherwise `added` is shown. */
installs?: number;
added?: string;
}) {
return (
{plugin.name}
{installs === undefined ? (
added
) : (
<>
{formatInstalls(installs)}
>
)}
{plugin.description}
);
}
/** Ranked row for the directory's Most installed list. */
export function PluginRankRow({
plugin,
rank,
installs,
}: {
plugin: Plugin;
rank: number;
installs: number;
}) {
return (
{rank}
{plugin.name}
{getCategory(plugin.categories[0])?.label}
{formatInstalls(installs)}
);
}