diff --git a/src/components/CoinData.jsx b/src/components/CoinData.jsx new file mode 100644 index 0000000..841a837 --- /dev/null +++ b/src/components/CoinData.jsx @@ -0,0 +1,67 @@ +import React from 'react'; + +const CoinData = ({ data }) => { + console.log(data); // Ensure data is received and logged properly + + if (!data || Object.keys(data).length === 0) { + return
Current Price:
+${coin.current_price.toFixed(2)}
+Market Cap:
+${coin.market_cap.toLocaleString()}
+Total Volume:
+${coin.total_volume.toLocaleString()}
+Circulating Supply:
+{coin.circulating_supply.toLocaleString()} {coin.symbol ? coin.symbol.toUpperCase() : ''}
+High 24h:
+${coin.high_24h.toFixed(2)}
+Low 24h:
+${coin.low_24h.toFixed(2)}
+Price Change (24h):
+${coin.price_change_24h.toFixed(2)} ({coin.price_change_percentage_24h.toFixed(2)}%)
+All-time High:
+${coin.ath.toFixed(2)} ({new Date(coin.ath_date).toLocaleDateString()})
+All-time Low:
+${coin.atl.toFixed(2)} ({new Date(coin.atl_date).toLocaleDateString()})
+Last Updated:
+{new Date(coin.last_updated).toLocaleString()}
+