g1t/apps/docs/src/components/Card.astro
Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 1 | --- |
| 2 | // Starlight's <Card>, with a Lucide icon: `icon` is a name from lucide.dev. | |
| 3 | // The icon is a little larger than Starlight's so a line icon reads inside | |
| 4 | // its padded tile. | |
| 5 | import LucideIcon from './LucideIcon.astro'; | |
| 6 | ||
| 7 | interface Props { | |
| 8 | icon?: string; | |
| 9 | title: string; | |
| 10 | } | |
| 11 | ||
| 12 | const { icon, title } = Astro.props; | |
| 13 | --- | |
| 14 | ||
| 15 | <article class="card sl-flex"> | |
| 16 | <p class="title sl-flex"> | |
| 17 | {icon && <LucideIcon name={icon} class="icon" size="1.6em" />} | |
| 18 | <span set:html={title} /> | |
| 19 | </p> | |
| 20 | <div class="body"><slot /></div> | |
| 21 | </article> | |
| 22 | ||
| 23 | <style> | |
| 24 | @layer starlight.components { | |
| 25 | .card { | |
| 26 | border: 1px solid var(--sl-color-gray-5); | |
| 27 | background-color: var(--sl-color-black); | |
| 28 | padding: clamp(1rem, calc(0.125rem + 3vw), 2.5rem); | |
| 29 | flex-direction: column; | |
| 30 | gap: clamp(0.5rem, calc(0.125rem + 1vw), 1rem); | |
| 31 | } | |
| 32 | .title { | |
| 33 | font-weight: 600; | |
| 34 | font-size: var(--sl-text-h4); | |
| 35 | color: var(--sl-color-white); | |
| 36 | line-height: var(--sl-line-height-headings); | |
| 37 | gap: 1rem; | |
| 38 | align-items: center; | |
| 39 | } | |
| 40 | .card :global(.icon) { | |
| 41 | padding: 0.2em; | |
| 42 | border-radius: 0.25rem; | |
| 43 | flex-shrink: 0; | |
| 44 | } | |
| 45 | .card .body { | |
| 46 | margin: 0; | |
| 47 | font-size: clamp(var(--sl-text-sm), calc(0.5rem + 1vw), var(--sl-text-body)); | |
| 48 | } | |
| 49 | } | |
| 50 | </style> |