SocialIcons.astro 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ---
  2. // Docs-header right cluster: Docs + Languages text links, Starlight's default
  3. // social icons (the GitHub link), and a live star-count pill — same order as
  4. // the landing nav (Docs · Languages · GitHub · Star). Done here, in the slot we
  5. // already own, to avoid a full header rebuild that could break search/mobile.
  6. import Default from '@astrojs/starlight/components/SocialIcons.astro';
  7. import { getStarsLabel } from '../lib/github';
  8. const stars = await getStarsLabel();
  9. const base = import.meta.env.BASE_URL.replace(/\/$/, '');
  10. const repo = 'https://github.com/colbymchenry/codegraph';
  11. ---
  12. <a class="cg-navlink" href={`${base}/getting-started/introduction/`}>Docs</a>
  13. <a class="cg-navlink" href={`${base}/reference/languages/`}>Languages</a>
  14. <Default {...Astro.props} />
  15. <a
  16. class="cg-star"
  17. href={`${repo}/stargazers`}
  18. target="_blank"
  19. rel="noopener noreferrer"
  20. aria-label={`${stars} GitHub stars`}
  21. >
  22. <span class="cg-star-glyph" aria-hidden="true">★</span>{stars}
  23. </a>
  24. <style>
  25. .cg-navlink {
  26. font-family: var(--sl-font);
  27. font-size: 0.9rem;
  28. font-weight: 500;
  29. line-height: 1;
  30. color: var(--cg-ink);
  31. text-decoration: none;
  32. white-space: nowrap;
  33. }
  34. .cg-navlink:hover {
  35. text-decoration: underline;
  36. text-underline-offset: 4px;
  37. }
  38. .cg-star {
  39. display: inline-flex;
  40. align-items: center;
  41. gap: 0.35rem;
  42. border: 1px solid var(--cg-rule);
  43. padding: 0.32rem 0.6rem;
  44. font-family: var(--sl-font);
  45. font-size: 0.85rem;
  46. font-weight: 600;
  47. line-height: 1;
  48. color: var(--cg-ink);
  49. text-decoration: none;
  50. white-space: nowrap;
  51. font-variant-numeric: tabular-nums;
  52. }
  53. .cg-star:hover {
  54. background: var(--cg-paper-press);
  55. color: var(--cg-ink);
  56. }
  57. .cg-star-glyph {
  58. font-size: 0.85em;
  59. }
  60. /* Keep the compact mobile header clean — the sidebar covers navigation there. */
  61. @media (max-width: 50rem) {
  62. .cg-navlink,
  63. .cg-star {
  64. display: none;
  65. }
  66. }
  67. </style>