From 80bfdbe52884870b8cb7748861bf990cb6235959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Geonizeli?= Date: Sat, 11 Sep 2021 12:14:54 -0300 Subject: [PATCH] improve table component --- .../src/components/Table/TableRow.tsx | 6 +- app/javascript/src/pages/Wallet/Balance.tsx | 59 ++++++------------- 2 files changed, 24 insertions(+), 41 deletions(-) diff --git a/app/javascript/src/components/Table/TableRow.tsx b/app/javascript/src/components/Table/TableRow.tsx index c549712..ffb3099 100644 --- a/app/javascript/src/components/Table/TableRow.tsx +++ b/app/javascript/src/components/Table/TableRow.tsx @@ -26,7 +26,11 @@ export const TableRow: FC = ({ items, id, onClick }) => { > {items?.map((item, index) => ( -

{item}

+ {typeof item === "string" ? ( +

{item}

+ ) : ( + item + )} ))} diff --git a/app/javascript/src/pages/Wallet/Balance.tsx b/app/javascript/src/pages/Wallet/Balance.tsx index 9dd5f12..77c7a52 100644 --- a/app/javascript/src/pages/Wallet/Balance.tsx +++ b/app/javascript/src/pages/Wallet/Balance.tsx @@ -3,6 +3,7 @@ import type { FC } from "react"; import React from "react"; import { useFragment } from "react-relay"; +import { Table, TableRow } from "../../components"; import { getCurrencyLogo } from "../../utils/getCurrencyLogo"; import type { Balance_balance$key } from "./__generated__/Balance_balance.graphql"; @@ -24,47 +25,25 @@ export const Balance: FC = ({ balancesRef }) => { return (
- - - - - - - - - -
- Moeda - - Saldo -
-
-
- CAKE icon -
-
-

CAKE

-
+ + +
+ CAKE icon
- -
- - -
-

- {node.amount} -

-
+
+

CAKE

+
+
, + node.amount, + ]} + /> +
);