Spaces:
Running

axeronis
style: Unify hardcoded colors to CSS variables
dc7e33a
Raw History Blame Contribute Delete
2.45 kB
'use client'
import { LucideIcon } from 'lucide-react'
import { cn } from '@/lib/utils'
interface StatsCardProps {
title: string
value: string | number
icon: LucideIcon
trend?: {
value: number
isPositive: boolean
}
className?: string
iconColor?: string
iconBgColor?: string
}
export function StatsCard({
title,
value,
icon: Icon,
trend,
className,
iconColor = 'text-blue-600',
iconBgColor = 'bg-blue-50'
}: StatsCardProps) {
return (
<div className={cn(
"group relative bg-surface-elevated rounded-2xl border border-white/10 p-6 transition-all duration-300 hover:border-indigo-500/30 hover:-translate-y-0.5 hover:shadow-[0_0_30px_-5px_rgba(99,102,241,0.15)]",
className
)}>
{/* Premium gradient overlay */}
<div className="absolute inset-0 bg-gradient-to-br from-indigo-500/0 via-purple-500/0 to-pink-500/0 group-hover:from-indigo-500/5 group-hover:via-purple-500/3 group-hover:to-pink-500/5 transition-all duration-500 rounded-2xl" />
<div className="relative flex items-start justify-between">
<div className="flex-1">
<p className="text-xs font-semibold text-slate-400 uppercase tracking-wider mb-2">{title}</p>
<p className="text-4xl font-bold text-white tracking-tight">{value}</p>
{trend && (
<div className="flex items-center gap-2 mt-4">
<div className={cn(
"flex items-center gap-1 text-xs font-bold px-2.5 py-1 rounded-lg",
trend.isPositive
? "bg-emerald-500/20 text-emerald-400 ring-1 ring-emerald-500/30"
: "bg-red-500/20 text-red-400 ring-1 ring-red-500/30"
)}>
<span>{trend.isPositive ? '↑' : '↓'}</span>
<span>{Math.abs(trend.value)}%</span>
</div>
<span className="text-xs text-slate-500 font-medium">по сравнению с прошлым месяцем</span>
</div>
)}
</div>
{/* Icon with modern styling */}
<div className={cn(
"p-3.5 rounded-xl transition-all duration-300 group-hover:scale-110 border border-white/10",
iconBgColor.replace('bg-blue-50', 'bg-indigo-500/20').replace('bg-', 'bg-')
)}>
<Icon className={cn("w-5 h-5", iconColor.replace('text-blue-600', 'text-indigo-400'))} strokeWidth={2.5} />
</div>
</div>
</div>
)
}