Initial import of 1407 block sources under blocks/
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import { TrendingDown, TrendingUp } from "lucide-react";
|
||||
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const formatPrice = (value: number) =>
|
||||
`${value.toLocaleString("fa-IR")} ریال`;
|
||||
|
||||
const formatChange = (value: number) =>
|
||||
`${new Intl.NumberFormat("fa-IR", {
|
||||
minimumFractionDigits: 1,
|
||||
maximumFractionDigits: 1,
|
||||
signDisplay: "exceptZero",
|
||||
}).format(value)}٪`;
|
||||
|
||||
interface StatsCard1Props {
|
||||
title?: string;
|
||||
value?: string;
|
||||
change?: number;
|
||||
changeLabel?: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const StatsCard1 = ({
|
||||
title = "مجموع درآمد",
|
||||
value = formatPrice(45231890),
|
||||
change = 20.1,
|
||||
changeLabel = "نسبت به ماه گذشته",
|
||||
className,
|
||||
}: StatsCard1Props) => {
|
||||
const isPositive = change >= 0;
|
||||
|
||||
return (
|
||||
<Card dir="rtl" lang="fa" className={cn("w-full max-w-xs", className)}>
|
||||
<CardHeader className="pb-2">
|
||||
<CardTitle className="text-sm font-medium text-muted-foreground">
|
||||
{title}
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="text-3xl font-bold">{value}</div>
|
||||
<div className="mt-1 flex items-center gap-1 text-sm">
|
||||
{isPositive ? (
|
||||
<TrendingUp className="size-4 text-green-500" />
|
||||
) : (
|
||||
<TrendingDown className="size-4 text-red-500" />
|
||||
)}
|
||||
<span className={isPositive ? "text-green-500" : "text-red-500"}>
|
||||
{formatChange(change)}
|
||||
</span>
|
||||
<span className="text-muted-foreground">{changeLabel}</span>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export { StatsCard1 };
|
||||
Reference in New Issue
Block a user