ui.tsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. import type { ReactNode } from "react";
  2. import { cn } from "@/lib/utils";
  3. /** Small sentence-case label above a title (Apple's eyebrow). */
  4. export function Eyebrow({
  5. children,
  6. accent,
  7. className,
  8. }: {
  9. children: ReactNode;
  10. accent?: boolean;
  11. className?: string;
  12. }) {
  13. return (
  14. <p className={cn("eyebrow", accent && "text-ember-ink", className)}>
  15. {children}
  16. </p>
  17. );
  18. }
  19. export function ArrowUpRight({ className }: { className?: string }) {
  20. return (
  21. <svg
  22. aria-hidden
  23. className={cn("size-3.5", className)}
  24. fill="none"
  25. viewBox="0 0 16 16"
  26. >
  27. <path
  28. d="M4.5 11.5 11.5 4.5M5.5 4.5h6v6"
  29. stroke="currentColor"
  30. strokeLinecap="round"
  31. strokeLinejoin="round"
  32. strokeWidth="1.6"
  33. />
  34. </svg>
  35. );
  36. }
  37. export function Chevron({ className }: { className?: string }) {
  38. return (
  39. <svg
  40. aria-hidden
  41. className={cn("size-3", className)}
  42. fill="none"
  43. viewBox="0 0 12 12"
  44. >
  45. <path
  46. d="M4.5 2.5 8 6l-3.5 3.5"
  47. stroke="currentColor"
  48. strokeLinecap="round"
  49. strokeLinejoin="round"
  50. strokeWidth="1.7"
  51. />
  52. </svg>
  53. );
  54. }
  55. /** Apple-style text link: "Learn more ›". */
  56. export function TextLink({
  57. href,
  58. children,
  59. className,
  60. label,
  61. }: {
  62. href: string;
  63. children: ReactNode;
  64. className?: string;
  65. /** A fuller accessible name; it should start with the visible text. */
  66. label?: string;
  67. }) {
  68. const external = href.startsWith("http");
  69. return (
  70. <a
  71. aria-label={label}
  72. className={cn(
  73. "group/link inline-flex items-center gap-1 text-[15px] font-medium text-glacier-ink hover:underline hover:underline-offset-4",
  74. className,
  75. )}
  76. data-cursor={external ? "Open ↗" : undefined}
  77. href={href}
  78. rel={external ? "noopener noreferrer" : undefined}
  79. target={external ? "_blank" : undefined}
  80. >
  81. {children}
  82. <Chevron className="transition-transform duration-300 group-hover/link:translate-x-0.5" />
  83. </a>
  84. );
  85. }
  86. /** Frosted glass pill link (CSS-only glass, no JS). */
  87. export function GlassLink({
  88. href,
  89. children,
  90. className,
  91. cursor,
  92. }: {
  93. href: string;
  94. children: ReactNode;
  95. className?: string;
  96. cursor?: string;
  97. }) {
  98. const external = href.startsWith("http");
  99. return (
  100. <a
  101. className={cn(
  102. "lg group/link inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-[13px] font-medium transition-[scale] duration-300 hover:scale-[1.04] active:scale-[0.97]",
  103. className,
  104. )}
  105. data-cursor={cursor ?? (external ? "Open ↗" : undefined)}
  106. href={href}
  107. rel={external ? "noopener noreferrer" : undefined}
  108. target={external ? "_blank" : undefined}
  109. >
  110. <span aria-hidden className="lg-caustic" />
  111. <span>{children}</span>
  112. <ArrowUpRight className="transition-transform duration-300 group-hover/link:translate-x-0.5 group-hover/link:-translate-y-0.5" />
  113. </a>
  114. );
  115. }
  116. export function SampleNote({ className }: { className?: string }) {
  117. return (
  118. <p className={cn("text-[11px] text-muted", className)}>
  119. Illustration with sample data
  120. </p>
  121. );
  122. }