From 6d02b116e1a395848595279f38911701cf9520e8 Mon Sep 17 00:00:00 2001
From: meskio <meskio@sindominio.net>
Date: Mon, 28 Sep 2020 19:50:55 +0200
Subject: [PATCH] Add color to the transaction list depending if is ingres or
 egress

---
 src/TransactionList.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/TransactionList.js b/src/TransactionList.js
index a5e16de..9684dcc 100644
--- a/src/TransactionList.js
+++ b/src/TransactionList.js
@@ -19,6 +19,17 @@ const columns = [
     {dataField: 'total', text: 'Cantidad', formatter: cell => printMoney(cell)+" €"},
 ]
 
+function rowStyle(row) {
+    if (["purchase"].includes(row.type)) {
+        return {
+            backgroundColor: "#fcbabf"
+        };
+    }
+    return {
+        backgroundColor: "#c4fcba"
+    };
+}
+
 function TransactionList() {
     const [transactions, setTransactions] = useState([]);
     const [clickID, setClicID] = useState(null);
@@ -36,6 +47,7 @@ function TransactionList() {
                 rowEvents={{
                     onClick: (_, row) => setClicID(row.ID)
                 }}
+                rowStyle={rowStyle}
                 classes="stripped"
                 bordered={ false }
             />
-- 
GitLab