fix: bookmark widget sizing, generic globe icon, code-server brand icon
- multi-link bookmark cards now span 4/2 (matching the system widget) instead of 3/1, so they're not cramped and line up into an even 3-up row alongside it - the link list scrolls internally instead of stretching the card, so widgets in the same row stay equal height regardless of link count - BrandIcon gains a small "generic icon" escape hatch (currently just `globe`, via phosphor) for widgets that don't have a real brand mark - added a `coder` brand icon (Coder/code-server) for the Code Server link, since simple-icons has no official VS Code mark to use Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WpxhtQY3CExQdMs4j7MmJe
This commit is contained in:
@@ -1,7 +1,20 @@
|
|||||||
|
import { GlobeSimple } from "@phosphor-icons/react/ssr";
|
||||||
import { BRAND_ICON_PATHS } from "@/lib/brand-icons";
|
import { BRAND_ICON_PATHS } from "@/lib/brand-icons";
|
||||||
|
|
||||||
|
// Generic (non-brand) icons that don't belong in BRAND_ICON_PATHS - for
|
||||||
|
// widgets that link to something with no single logo of its own.
|
||||||
|
const GENERIC_ICONS = {
|
||||||
|
globe: GlobeSimple,
|
||||||
|
};
|
||||||
|
|
||||||
export function BrandIcon({ slug, size = 18 }: { slug?: string; size?: number }) {
|
export function BrandIcon({ slug, size = 18 }: { slug?: string; size?: number }) {
|
||||||
if (!slug) return null;
|
if (!slug) return null;
|
||||||
|
|
||||||
|
const GenericIcon = GENERIC_ICONS[slug as keyof typeof GENERIC_ICONS];
|
||||||
|
if (GenericIcon) {
|
||||||
|
return <GenericIcon size={size} className="shrink-0 text-fg-muted" aria-hidden />;
|
||||||
|
}
|
||||||
|
|
||||||
const path = BRAND_ICON_PATHS[slug];
|
const path = BRAND_ICON_PATHS[slug];
|
||||||
if (!path) return null;
|
if (!path) return null;
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ type BookmarkWidget = Extract<Widget, { type: "bookmark" }>;
|
|||||||
export function BookmarkWidget({ widget }: { widget: BookmarkWidget }) {
|
export function BookmarkWidget({ widget }: { widget: BookmarkWidget }) {
|
||||||
if (widget.links && widget.links.length > 0) {
|
if (widget.links && widget.links.length > 0) {
|
||||||
return (
|
return (
|
||||||
<div className={PN_CARD_CLASS} style={{ gridColumn: "span 3" }}>
|
<div className={PN_CARD_CLASS} style={{ gridColumn: "span 4", gridRow: "span 2" }}>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<BrandIcon slug={widget.icon} />
|
<BrandIcon slug={widget.icon} />
|
||||||
<span className="min-w-0 flex-1 truncate text-[15px] font-medium text-fg">{widget.name}</span>
|
<span className="min-w-0 flex-1 truncate text-[15px] font-medium text-fg">{widget.name}</span>
|
||||||
</div>
|
</div>
|
||||||
{widget.description && <span className="text-xs text-fg-muted">{widget.description}</span>}
|
{widget.description && <span className="text-xs text-fg-muted">{widget.description}</span>}
|
||||||
<div className="-mx-1 flex flex-col divide-y divide-border">
|
<div className="-mx-1 flex min-h-0 flex-1 flex-col divide-y divide-border overflow-y-auto">
|
||||||
{widget.links.map((link) => (
|
{widget.links.map((link) => (
|
||||||
<a
|
<a
|
||||||
key={link.href}
|
key={link.href}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -26,6 +26,7 @@ ICONS = {
|
|||||||
"postgresql": "postgresql",
|
"postgresql": "postgresql",
|
||||||
"redis": "redis",
|
"redis": "redis",
|
||||||
"headscale": "tailscale",
|
"headscale": "tailscale",
|
||||||
|
"coder": "coder",
|
||||||
}
|
}
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parent.parent
|
ROOT = Path(__file__).resolve().parent.parent
|
||||||
|
|||||||
Reference in New Issue
Block a user