Skip to content

Commit

Permalink
feat: ✨ add type-badge component
Browse files Browse the repository at this point in the history
  • Loading branch information
neopromic committed Nov 7, 2024
1 parent 8714294 commit 88ba359
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions app/(authenticated)/transactions/_components/type-badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Badge } from "@/app/_components/ui/badge";
import type { Transactions } from "@prisma/client";
import { CircleIcon } from "lucide-react";

interface TransactionTypeBadgeProps {
transaction: Transactions;
}

const TransactionTypeBadge = ({ transaction }: TransactionTypeBadgeProps) => {
if (transaction.type === "DEPOSIT") {
return (
<Badge className="bg-primary/10 text-primary hover:bg-primary/10">
<CircleIcon size={10} className="mr-2 fill-primary" />
Ganho
</Badge>
);
}
if (transaction.type === "EXPENSE") {
return (
<Badge className="bg-danger/10 text-danger hover:bg-danger">
<CircleIcon size={10} className="mr-2 fill-danger" />
Gasto
</Badge>
);
}
return (
<Badge className="bg-muted hover:bg-muted">
<CircleIcon size={10} className="mr-2 fill-white" />
Investimento
</Badge>
);
};

export default TransactionTypeBadge;

0 comments on commit 88ba359

Please sign in to comment.