2026-08-17 17:21:18 +02:00
|
|
|
import { ArrowUpRight } from "@phosphor-icons/react/ssr";
|
2026-08-17 13:49:55 +02:00
|
|
|
import type { Widget } from "@/lib/config/schema";
|
2026-08-17 17:21:18 +02:00
|
|
|
import { PN_CARD_CLASS } from "@/components/widgets/WidgetCard";
|
2026-08-17 17:55:27 +02:00
|
|
|
import { BrandIcon } from "@/components/widgets/BrandIcon";
|
2026-08-17 13:49:55 +02:00
|
|
|
|
|
|
|
|
type BookmarkWidget = Extract<Widget, { type: "bookmark" }>;
|
|
|
|
|
|
|
|
|
|
export function BookmarkWidget({ widget }: { widget: BookmarkWidget }) {
|
2026-08-18 10:14:47 +02:00
|
|
|
if (widget.links && widget.links.length > 0) {
|
|
|
|
|
return (
|
2026-08-18 10:26:45 +02:00
|
|
|
<div className={PN_CARD_CLASS} style={{ gridColumn: "span 4", gridRow: "span 2" }}>
|
2026-08-18 10:14:47 +02:00
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
<BrandIcon slug={widget.icon} />
|
|
|
|
|
<span className="min-w-0 flex-1 truncate text-[15px] font-medium text-fg">{widget.name}</span>
|
|
|
|
|
</div>
|
|
|
|
|
{widget.description && <span className="text-xs text-fg-muted">{widget.description}</span>}
|
2026-08-18 10:26:45 +02:00
|
|
|
<div className="-mx-1 flex min-h-0 flex-1 flex-col divide-y divide-border overflow-y-auto">
|
2026-08-18 10:14:47 +02:00
|
|
|
{widget.links.map((link) => (
|
|
|
|
|
<a
|
|
|
|
|
key={link.href}
|
|
|
|
|
href={link.href}
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noreferrer"
|
|
|
|
|
className="group flex items-center gap-2 px-1 py-1.5 text-sm text-fg-muted no-underline hover:text-accent"
|
|
|
|
|
>
|
|
|
|
|
<BrandIcon slug={link.icon} size={14} />
|
|
|
|
|
<span className="min-w-0 flex-1 truncate">{link.name}</span>
|
|
|
|
|
<ArrowUpRight
|
|
|
|
|
size={13}
|
|
|
|
|
className="shrink-0 text-accent opacity-0 group-hover:opacity-100"
|
|
|
|
|
aria-hidden
|
|
|
|
|
/>
|
|
|
|
|
</a>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-17 13:49:55 +02:00
|
|
|
return (
|
|
|
|
|
<a
|
|
|
|
|
href={widget.href}
|
|
|
|
|
target="_blank"
|
|
|
|
|
rel="noreferrer"
|
2026-08-17 17:21:18 +02:00
|
|
|
className={`${PN_CARD_CLASS} text-inherit no-underline`}
|
|
|
|
|
style={{ gridColumn: "span 3" }}
|
2026-08-17 13:49:55 +02:00
|
|
|
>
|
2026-08-17 17:21:18 +02:00
|
|
|
<div className="flex items-center gap-2">
|
2026-08-17 17:55:27 +02:00
|
|
|
<BrandIcon slug={widget.icon} />
|
|
|
|
|
<span className="min-w-0 flex-1 truncate text-[15px] font-medium text-fg">{widget.name}</span>
|
|
|
|
|
<ArrowUpRight size={16} className="shrink-0 text-accent" aria-hidden />
|
2026-08-17 17:21:18 +02:00
|
|
|
</div>
|
|
|
|
|
{widget.description && <span className="text-xs text-fg-muted">{widget.description}</span>}
|
2026-08-17 13:49:55 +02:00
|
|
|
</a>
|
|
|
|
|
);
|
|
|
|
|
}
|