Files
ember-market-frontend/components/analytics/MetricsCard.tsx
g 5d9f8fa07b
All checks were successful
Build Frontend / build (push) Successful in 1m17s
Redesign auth pages and enhance analytics UI with motion
Refactored login and registration pages for a modern, consistent look with animated backgrounds and improved form feedback. Enhanced analytics dashboard and metrics cards with framer-motion animations and visual polish. Updated MotionWrapper for flexible motion props and improved transitions. Minor UI/UX improvements and code cleanup throughout auth and analytics components.
2026-01-12 04:06:36 +00:00

69 lines
1.9 KiB
TypeScript

"use client"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { TrendingUp, TrendingDown, Minus } from "lucide-react";
import { LucideIcon } from "lucide-react";
import { motion } from "framer-motion";
interface MetricsCardProps {
title: string;
value: string;
description: string;
icon: LucideIcon;
trend: "up" | "down" | "neutral";
trendValue: string;
}
export default function MetricsCard({
title,
value,
description,
icon: Icon,
trend,
trendValue
}: MetricsCardProps) {
const getTrendIcon = () => {
switch (trend) {
case "up":
return <TrendingUp className="h-4 w-4 text-green-500" />;
case "down":
return <TrendingDown className="h-4 w-4 text-red-500" />;
default:
return <Minus className="h-4 w-4 text-gray-500" />;
}
};
const getTrendColor = () => {
switch (trend) {
case "up":
return "text-green-600";
case "down":
return "text-red-600";
default:
return "text-gray-600";
}
};
return (
<motion.div>
<Card className="hover:shadow-xl hover:border-indigo-500/30 transition-all duration-300">
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium text-muted-foreground">
{title}
</CardTitle>
<Icon className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">{value}</div>
<p className="text-xs text-muted-foreground mt-1">{description}</p>
<div className="flex items-center gap-1 mt-2">
{getTrendIcon()}
<span className={`text-xs ${getTrendColor()}`}>
{trendValue}
</span>
</div>
</CardContent>
</Card>
</motion.div>
);
}