({
icon,
amount,
label,
href,
external = false,
onClick,
}: {
icon?: ReactNode;
amount: number;
label: string;
href?: string;
external?: boolean;
onClick?: () => void;
})
| 164 | |
| 165 | // One strip at the profile page's sizes, so You and a profile read the same. |
| 166 | const Stat = ({ |
| 167 | icon, |
| 168 | amount, |
| 169 | label, |
| 170 | href, |
| 171 | external = false, |
| 172 | onClick, |
| 173 | }: { |
| 174 | icon?: ReactNode; |
| 175 | amount: number; |
| 176 | label: string; |
| 177 | href?: string; |
| 178 | external?: boolean; |
| 179 | onClick?: () => void; |
| 180 | }): ReactElement => { |
| 181 | const className = |
| 182 | 'flex h-6 items-center gap-1 rounded-8 transition-colors hover:bg-surface-hover'; |
| 183 | const content = ( |
| 184 | <> |
| 185 | {icon} |
| 186 | <b className="tabular-nums text-text-primary typo-callout"> |
| 187 | {largeNumberFormat(amount)} |
| 188 | </b> |
| 189 | <span className="text-text-tertiary">{label}</span> |
| 190 | </> |
| 191 | ); |
| 192 | |
| 193 | if (href && external) { |
| 194 | return ( |
| 195 | <a |
| 196 | href={href} |
| 197 | target="_blank" |
| 198 | rel="noopener noreferrer" |
| 199 | className={className} |
| 200 | > |
| 201 | {content} |
| 202 | </a> |
| 203 | ); |
| 204 | } |
| 205 | |
| 206 | if (href) { |
| 207 | return ( |
| 208 | <Link href={href} passHref> |
| 209 | <a className={className}>{content}</a> |
| 210 | </Link> |
| 211 | ); |
| 212 | } |
| 213 | |
| 214 | return ( |
| 215 | <button type="button" onClick={onClick} className={className}> |
| 216 | {content} |
| 217 | </button> |
| 218 | ); |
| 219 | }; |
| 220 | |
| 221 | const usePlusRow = (): { label: string; meta: string } => { |
| 222 | const { isPlus, status } = usePlusSubscription(); |
nothing calls this directly
no test coverage detected