Skip to content

Commit

Permalink
feat: add customers table
Browse files Browse the repository at this point in the history
  • Loading branch information
soyricardodev committed Jul 14, 2024
1 parent fa45210 commit e2fca3e
Showing 1 changed file with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {
Card,
CardHeader,
CardTitle,
CardDescription,
CardContent,
} from "@theliaison/ui/card";
import {
Table,
TableHeader,
TableRow,
TableHead,
TableBody,
TableCell,
} from "@theliaison/ui/table";
import type { Stripe } from "stripe";

export function Customers({ customers }: { customers: Stripe.Customer[] }) {
return (
<Table>
<TableHeader>
<TableRow>
<TableHead className="hidden sm:table-cell">Name</TableHead>
<TableHead>Email</TableHead>
<TableHead className="text-right">Balance</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{customers.map(({ id, email, name, balance, cash_balance }, index) => (
<TableRow key={id} className={`${index % 2 === 0 ? "bg-muted" : ""}`}>
<TableCell className="hidden sm:block">{name}</TableCell>
<TableCell>{email}</TableCell>
<TableCell className="text-right">
{Intl.NumberFormat("en-US", {
style: "currency",
currency: "USD",
minimumFractionDigits: 2,
maximumFractionDigits: 2,
}).format(balance)}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
);
}

0 comments on commit e2fca3e

Please sign in to comment.