History

feat(react): use favicon on connected source list items (#226)

* feat(react): use favicon on connected source list items Replace the generic SVG icon in the connected sources list with SourceFavicon, which renders the site's actual favicon from the source URL. * fix(react): match favicon size to popular sources list (20px) * fix(react): match favicon size to CardStackEntryMedia container (32px)

Moritz Meyer committed 7 months ago

Commit b685f361 parent bdf736b1 file · +3 −9Browse files

Unified · Split

packages/react/src/pages/sources.tsx+3−9
@@ -20,6 +20,7 @@ import { · 19 unmodified lines
2020 CardStackEntryDescription,
2121 CardStackEntryActions,
2222 } from "../components/card-stack";
23+import { SourceFavicon } from "../components/source-favicon";
2324
2425 const KIND_TO_PLUGIN_KEY: Record<string, string> = {
2526 openapi: "openapi",
@@ -267,6 +268,7 @@ function SourceGrid(props: { · 241 unmodified lines
267268 id: string;
268269 name: string;
269270 kind: string;
271+ url?: string;
270272 runtime?: boolean;
271273 }[];
272274 }) {
@@ -278,15 +280,7 @@ function SourceGrid(props: { · 5 unmodified lines
278280 <CardStackEntry key={s.id} asChild searchText={`${s.name} ${s.id} ${s.kind}`}>
279281 <Link to="/sources/$namespace" params={{ namespace: s.id }}>
280282 <CardStackEntryMedia>
281− <svg viewBox="0 0 16 16" className="size-3.5" fill="none">
282− <circle cx="8" cy="8" r="6" stroke="currentColor" strokeWidth="1.2" />
283− <path
284− d="M8 5v6M5 8h6"
285− stroke="currentColor"
286− strokeWidth="1.2"
287− strokeLinecap="round"
288− />
289− </svg>
283+ <SourceFavicon url={s.url} size={32} />
290284 </CardStackEntryMedia>
291285 <CardStackEntryContent>
292286 <CardStackEntryTitle>{s.name}</CardStackEntryTitle>