feat: light icons on the dark cards

A link without an icon of its own gets the library's light version when
there is one (github-light), instead of a dark logo on a dark card. The
server keeps the library's list of names for a day.
This commit is contained in:
Niklas Haiden
2026-11-21 19:18:08 +01:00
parent 56ed40e8b0
commit cba6eddc56
7 changed files with 90 additions and 10 deletions
+4 -2
View File
@@ -12,14 +12,16 @@ export type HomeLink = {
name: string
url: string
icon: string | null
/** the library's light version of the icon, when the link has no icon of its own */
lightIcon: string | null
}
type IconProps = { link: HomeLink; className?: string }
/** Starts the fallback chain again when the link changes. */
export function LinkIcon(props: IconProps) {
const { id, name, url, icon } = props.link
return <Icon key={[id, name, url, icon].join("|")} {...props} />
const { id, name, url, icon, lightIcon } = props.link
return <Icon key={[id, name, url, icon, lightIcon].join("|")} {...props} />
}
function Icon({ link, className }: IconProps) {