From 7208ed7d47bb16f2edcbe3f75e8fd42d49edc148 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Sat, 19 Dec 2020 21:53:47 +0000 Subject: [PATCH] changed walletcard to have an internal state and not props. --- websrc/components/Cards.tsx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/websrc/components/Cards.tsx b/websrc/components/Cards.tsx index a23cd2b..25b82ba 100644 --- a/websrc/components/Cards.tsx +++ b/websrc/components/Cards.tsx @@ -1,5 +1,5 @@ import React, {Component} from 'react'; -import * as Icon from 'react-cryptocoins'; +import {Currency} from "../types"; type CardProps = { title: string, @@ -73,20 +73,28 @@ export class SidebarCard extends Component { } } -export type WalletCardProps = { +export type WalletCardState = { balances: Array, total_balance: number, - quote_symbol: string + quote: Currency, } -export class WalletCard extends Component { + +export class WalletCard extends Component<{}, WalletCardState> { + state = { + balances: [], + total_balance: 0, + quote: {name: "USD", short_name: "$"} + } + constructor(props) { super(props); } + renderCoinBalances() { return ( - this.props.balances.map((balance) => { + this.state.balances.map((balance) => { return ( {
- Total Balance ≈ {this.props.quote_symbol}{this.props.total_balance.toFixed(2)} + Total Balance ≈ {this.state.quote_symbol}{this.props.total_balance.toFixed(2)}