MCPcopy Create free account
hub / github.com/codename-co/stack / Card

Function Card

packages/website/src/components/Card.tsx:19–118  ·  view source on GitHub ↗
({
  className,
  children,
  description,
  icon,
  lang,
  name,
  slug,
  small,
  stars,
  style,
  updated_at,
  url,
})

Source from the content-addressed store, hash-verified

17 breathing?: boolean;
18 mentionHtml?: string;
19 children?: React.ReactNode;
20};
21
22/**
23 * A catalog entry, rendered as a GlassCard.
24 *
25 * The one thing the library cannot know is the software's own brand color, so
26 * the icon tile — and only the icon tile — is tinted from the simple-icons hex.
27 * Everything else (chrome, halo, hover lift) is left to performative-ui, which
28 * keeps 250+ cards on the same surface treatment as the rest of the page.
29 */
30const Card: React.FC<CardProps> = ({
31 className,
32 children,
33 description,
34 icon,
35 lang,
36 name,
37 slug,
38 small,
39 stars,
40 style,
41 updated_at,
42 url,
43 breathing,
44 mentionHtml,
45}) => {
46 // `logoFromIcon` yields the icon record, an empty string, or null depending
47 // on which of the three lookups hit. Normalise once, here.
48 const resolved = logoFromIcon({ slug, icon });
49 const logo = resolved && typeof resolved === "object" ? resolved : null;
50
51 return (
52 <div
53 // `small` cards live in dense grids (the related rail, the alternatives
54 // list). The catalog's min-widths are what forced those into one
55 // full-width card per row.
56 className={`relative w-full ${
57 small ? "min-w-0" : "min-w-56 md:min-w-72 lg:min-w-96"
58 } ${className ?? ""}`}
59 style={style}
60 >
61 {children}
62 <GlassCard
63 breathing={breathing}
64 glowOnHover
65 className={`h-full ${small ? "!p-4" : ""}`}
66 style={
67 {
68 // Bleed the brand color into the card's own halo.
69 ...(logo?.hex &&
70 logo.hex !== "currentColor" && {
71 "--pui-grad-from": logo.hex,
72 }),
73 } as React.CSSProperties
74 }
75 >
76 <a

Callers

nothing calls this directly

Calls 2

logoFromIconFunction · 0.90
formatStarsFunction · 0.85

Tested by

no test coverage detected