main
tsx 97 lines 3.16 KB
Raw
1 import { ArrowUpRight, Coffee, Monitor, Plane } from "lucide-react";
2 import { Button } from "@/components/ui/button";
3
4 const transactions = [
5 {
6 id: 1,
7 description: "Figma Pro Subscription",
8 category: "Software",
9 amount: -15.00,
10 date: "Today",
11 icon: Monitor,
12 status: "approved"
13 },
14 {
15 id: 2,
16 description: "Team Lunch - Pizza Hut",
17 category: "Food & Meals",
18 amount: -89.50,
19 date: "Yesterday",
20 icon: Coffee,
21 status: "approved"
22 },
23 {
24 id: 3,
25 description: "Flight to NYC - Conference",
26 category: "Travel",
27 amount: -324.00,
28 date: "Nov 22",
29 icon: Plane,
30 status: "pending"
31 },
32 {
33 id: 4,
34 description: "AWS Credits",
35 category: "Software",
36 amount: -120.00,
37 date: "Nov 20",
38 icon: Monitor,
39 status: "approved"
40 },
41 ];
42
43 const RecentTransactions = () => {
44 return (
45 <section className="py-12 bg-muted/30">
46 <div className="container">
47 <div className="max-w-4xl mx-auto">
48 <div className="flex items-center justify-between mb-6 animate-fade-up">
49 <h2 className="text-xl md:text-2xl font-bold text-foreground">
50 Recent activity
51 </h2>
52 <Button variant="ghost" className="text-primary hover:text-primary/80">
53 View all <ArrowUpRight className="w-4 h-4 ml-1" />
54 </Button>
55 </div>
56
57 <div className="bg-card rounded-2xl border border-border overflow-hidden animate-fade-up animation-delay-100">
58 {transactions.map((transaction, index) => {
59 const Icon = transaction.icon;
60
61 return (
62 <div
63 key={transaction.id}
64 className={`flex items-center gap-4 p-4 hover:bg-muted/50 transition-colors cursor-pointer ${
65 index !== transactions.length - 1 ? 'border-b border-border' : ''
66 }`}
67 >
68 <div className="w-10 h-10 bg-muted rounded-lg flex items-center justify-center">
69 <Icon className="w-5 h-5 text-muted-foreground" />
70 </div>
71 <div className="flex-1 min-w-0">
72 <p className="font-medium text-foreground truncate">{transaction.description}</p>
73 <p className="text-sm text-muted-foreground">{transaction.category} • {transaction.date}</p>
74 </div>
75 <div className="text-right">
76 <p className="font-semibold text-foreground">
77 ${Math.abs(transaction.amount).toFixed(2)}
78 </p>
79 <span className={`text-xs font-medium px-2 py-0.5 rounded-full ${
80 transaction.status === 'approved'
81 ? 'bg-primary/20 text-primary'
82 : 'bg-orange-100 text-orange-600 dark:bg-orange-900/30 dark:text-orange-400'
83 }`}>
84 {transaction.status}
85 </span>
86 </div>
87 </div>
88 );
89 })}
90 </div>
91 </div>
92 </div>
93 </section>
94 );
95 };
96
97 export default RecentTransactions;