Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | /** * One celebration stat tile — the value pops, the label whispers, the tone * picks the gradient. Used by the public song-share page to render the * accuracy / problems / streak / age stats that the share's privacy toggles * permitted (none of these render unless the corresponding `show*` flag was * enabled — gating happens in `getSharedSong`). * * Visually a soft gradient card with a top-left glyph and a big numeric. * Tones map to the brand-extended celebration palette agreed in the * song-share redesign plan. */ import type { ReactNode } from 'react' import { css } from '../../../styled-system/css' export type TrophyTone = 'emerald' | 'sky' | 'amber' | 'rose' interface TrophyTileProps { tone: TrophyTone glyph: string value: ReactNode label: string } interface ToneStyles { gradient: string border: string glyph: string value: string label: string } const TONES: Record<TrophyTone, ToneStyles> = { emerald: { gradient: 'linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%)', border: '1px solid rgba(16, 185, 129, 0.25)', glyph: '#10b981', value: '#047857', label: '#065f46', }, sky: { gradient: 'linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%)', border: '1px solid rgba(59, 130, 246, 0.25)', glyph: '#3b82f6', value: '#1d4ed8', label: '#1e40af', }, amber: { gradient: 'linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%)', border: '1px solid rgba(245, 158, 11, 0.3)', glyph: '#d97706', value: '#b45309', label: '#92400e', }, rose: { gradient: 'linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%)', border: '1px solid rgba(244, 63, 94, 0.25)', glyph: '#e11d48', value: '#be123c', label: '#9f1239', }, } export function TrophyTile({ tone, glyph, value, label }: TrophyTileProps) { const t = TONES[tone] return ( <div data-component="trophy-tile" data-tone={tone} className={css({ display: 'flex', flexDirection: 'column', gap: '4px', borderRadius: '16px', padding: '14px 16px', minW: '120px', boxShadow: '0 2px 10px rgba(124, 58, 237, 0.06)', })} style={{ background: t.gradient, border: t.border, }} > <div aria-hidden="true" className={css({ fontSize: '20px', lineHeight: 1 })} style={{ color: t.glyph }} > {glyph} </div> <div className={css({ fontFamily: 'display', fontWeight: 700, fontSize: '30px', lineHeight: 1.05, fontVariantNumeric: 'tabular-nums', })} style={{ color: t.value }} > {value} </div> <div className={css({ fontSize: '11px', textTransform: 'uppercase', letterSpacing: '0.06em', fontWeight: 600, })} style={{ color: t.label }} > {label} </div> </div> ) } |