57 lines · 2.2 KBRaw
| 1 | import { useId } from "react"; |
| 2 | import { Link } from "../provider"; |
| 3 | import { cn } from "../ui/cn"; |
| 4 | |
| 5 | export function LogoMark({ className = "size-[1.15em]" }: { className?: string }) { |
| 6 | const mask = useId(); |
| 7 | return ( |
| 8 | <svg viewBox="0 0 24 24" aria-hidden="true" className={`shrink-0 ${className}`}> |
| 9 | <mask id={mask}> |
| 10 | <rect x="1.5" y="1.5" width="21" height="21" rx="5.5" fill="#fff" /> |
| 11 | <path d="M6.5 8h11M6.5 12h7M6.5 16h3" stroke="#000" strokeWidth="2.2" strokeLinecap="round" /> |
| 12 | </mask> |
| 13 | <rect x="1.5" y="1.5" width="21" height="21" rx="5.5" fill="currentColor" mask={`url(#${mask})`} /> |
| 14 | <circle cx="14.6" cy="16" r="2.1" fill="#f6821f" /> |
| 15 | </svg> |
| 16 | ); |
| 17 | } |
| 18 | |
| 19 | export function Wordmark({ large = false }: { large?: boolean }) { |
| 20 | return ( |
| 21 | <Link href="/" aria-label="refs home" className={`wordmark rounded-chip text-ink ${large ? "text-3xl" : "text-[1.2143rem]"}`}> |
| 22 | <LogoMark /> |
| 23 | refs |
| 24 | </Link> |
| 25 | ); |
| 26 | } |
| 27 | |
| 28 | function initials(name: string): string { |
| 29 | return ( |
| 30 | name |
| 31 | .split(/\s+/) |
| 32 | .filter(Boolean) |
| 33 | .slice(0, 2) |
| 34 | .map((part) => part[0]!.toUpperCase()) |
| 35 | .join("") || "?" |
| 36 | ); |
| 37 | } |
| 38 | |
| 39 | const SIZE = { xs: "size-5 text-[0.6429rem]", sm: "size-6 text-[0.7143rem]", base: "size-8 text-xs", lg: "size-11 text-sm" }; |
| 40 | |
| 41 | /** A person: a filled blue roundel. Every human act in refs carries this mark. */ |
| 42 | export function Avatar({ name, size = "sm", className }: { name: string; size?: keyof typeof SIZE; className?: string }) { |
| 43 | return ( |
| 44 | <span aria-hidden="true" className={cn("inline-flex shrink-0 items-center justify-center rounded-full bg-accent font-semibold text-on-accent shadow-[inset_0_1px_0_rgb(255_255_255/0.22)]", SIZE[size], className)}> |
| 45 | {initials(name)} |
| 46 | </span> |
| 47 | ); |
| 48 | } |
| 49 | |
| 50 | /** An agent: a hollow ring, like a station on the line. Agent work never wears the human fill. */ |
| 51 | export function AgentAvatar({ name, size = "sm", className }: { name: string; size?: keyof typeof SIZE; className?: string }) { |
| 52 | return ( |
| 53 | <span aria-hidden="true" className={cn("inline-flex shrink-0 items-center justify-center rounded-full font-semibold text-porcelain shadow-[inset_0_0_0_1.5px_var(--porcelain)]", SIZE[size], className)}> |
| 54 | {initials(name)} |
| 55 | </span> |
| 56 | ); |
| 57 | } |