Spaces:
Running
Running
Download frontend/src/shared/components/Card.tsx from Shadowfilebot/Bot: direct link, hf CLI and curl.
- Browser
- Download file 1.95 kB
-
https://huggingface.co/spaces/Shadowfilebot/Bot/resolve/main/frontend/src/shared/components/Card.tsx
- Command line
-
hf download hf://spaces/Shadowfilebot/Bot/frontend/src/shared/components/Card.tsx
-
curl -L -o Card.tsx https://huggingface.co/spaces/Shadowfilebot/Bot/resolve/main/frontend/src/shared/components/Card.tsx
1.95 kB
| import React from 'react'; | |
| import { cn } from '@/shared/lib/cn'; | |
| export function Card({ | |
| className, | |
| children, | |
| }: { | |
| className?: string; | |
| children: React.ReactNode; | |
| }) { | |
| return ( | |
| <div className={cn('rounded-2xl bg-surface-1 border border-line', className)}>{children}</div> | |
| ); | |
| } | |
| type BadgeTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger'; | |
| const BADGE_CLASSES: Record<BadgeTone, string> = { | |
| neutral: 'bg-surface-2 text-ink-2 border-line', | |
| accent: 'bg-accent/10 text-accent border-accent/30', | |
| success: 'bg-emerald-500/10 text-emerald-500 border-emerald-500/30', | |
| warning: 'bg-amber-500/10 text-amber-500 border-amber-500/30', | |
| danger: 'bg-rose-500/10 text-rose-500 border-rose-500/30', | |
| }; | |
| export function Badge({ | |
| tone = 'neutral', | |
| className, | |
| children, | |
| }: { | |
| tone?: BadgeTone; | |
| className?: string; | |
| children: React.ReactNode; | |
| }) { | |
| return ( | |
| <span | |
| className={cn( | |
| 'inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full border text-[11px] font-medium', | |
| BADGE_CLASSES[tone], | |
| className, | |
| )} | |
| > | |
| {children} | |
| </span> | |
| ); | |
| } | |
| export function MetricTile({ | |
| label, | |
| value, | |
| hint, | |
| icon, | |
| }: { | |
| label: string; | |
| value: string | number; | |
| hint?: string; | |
| icon?: React.ReactNode; | |
| }) { | |
| return ( | |
| <Card className="p-4 space-y-1.5"> | |
| <div className="flex items-center justify-between text-xs text-ink-2"> | |
| <span>{label}</span> | |
| {icon && ( | |
| <span className="text-accent" aria-hidden="true"> | |
| {icon} | |
| </span> | |
| )} | |
| </div> | |
| <div className="text-xl font-bold font-mono tabular-nums text-ink-1">{value}</div> | |
| {hint && <div className="text-[11px] text-ink-3">{hint}</div>} | |
| </Card> | |
| ); | |
| } | |
| export function Skeleton({ className }: { className?: string }) { | |
| return ( | |
| <div | |
| aria-hidden="true" | |
| className={cn('rounded-xl bg-surface-2 animate-pulse', className)} | |
| /> | |
| ); | |
| } | |