Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
meabhisingh committed Oct 15, 2022
1 parent 045eafa commit a0dd4b4
Show file tree
Hide file tree
Showing 23 changed files with 15,331 additions and 11,672 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.vercel
26,220 changes: 14,659 additions & 11,561 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@chakra-ui/react": "^2.3.5",
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.1.2",
"chart.js": "^3.9.1",
"framer-motion": "^7.5.3",
"react": "^18.2.0",
"react-chartjs-2": "^4.3.1",
"react-dom": "^18.2.0",
"react-icons": "^4.6.0",
"react-router-dom": "^6.4.2",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
Expand Down
10 changes: 6 additions & 4 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap"
rel="stylesheet"
/>
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
Expand Down
38 changes: 0 additions & 38 deletions src/App.css

This file was deleted.

36 changes: 18 additions & 18 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import logo from './logo.svg';
import './App.css';
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import Header from "./components/Header";
import Home from "./components/Home";
import Coins from "./components/Coins";
import Exchanges from "./components/Exchanges";
import CoinDetails from "./components/CoinDetails";
import Footer from "./components/Footer";

function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
<Router>
<Header />
<Routes>
<Route path="/" element={<Home />} />
<Route path="/coins" element={<Coins />} />
<Route path="/exchanges" element={<Exchanges />} />
<Route path="/coin/:id" element={<CoinDetails />} />
</Routes>

<Footer />
</Router>
);
}

Expand Down
8 changes: 0 additions & 8 deletions src/App.test.js

This file was deleted.

Binary file added src/assets/btc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions src/components/Chart.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from "react";
import { Line } from "react-chartjs-2";
import {
Chart as ChartJS,
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend,
} from "chart.js";

ChartJS.register(
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend
);

const Chart = ({ arr = [], currency, days }) => {
const prices = [];
const date = [];

for (let i = 0; i < arr.length; i++) {
if (days === "24h") date.push(new Date(arr[i][0]).toLocaleTimeString());
else date.push(new Date(arr[i][0]).toLocaleDateString());
prices.push(arr[i][1]);
}

const data = {
labels: date,
datasets: [
{
label: `Price in ${currency}`,
data: prices,
borderColor: "rgb(255,99,132)",
backgroundColor: "rgba(255,99,132,0.5)",
},
],
};

return (
<Line
options={{
responsive: true,
}}
data={data}
/>
);
};

export default Chart;
37 changes: 37 additions & 0 deletions src/components/CoinCard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Heading, Image, Text, VStack } from "@chakra-ui/react";
import React from "react";
import { Link } from "react-router-dom";

const CoinCard = ({ id, name, img, symbol, price, currencySymbol = "₹" }) => (
<Link to={`/coin/${id}`}>
<VStack
w={"52"}
shadow={"lg"}
p={"8"}
borderRadius={"lg"}
transition={"all 0.3s"}
m={"4"}
css={{
"&:hover": {
transform: "scale(1.1)",
},
}}
>
<Image
src={img}
w={"10"}
h={"10"}
objectFit={"contain"}
alt={"Exchange"}
/>
<Heading size={"md"} noOfLines={1}>
{symbol}
</Heading>

<Text noOfLines={1}>{name}</Text>
<Text noOfLines={1}>{price ? `${currencySymbol}${price}` : "NA"}</Text>
</VStack>
</Link>
);

export default CoinCard;
Loading

0 comments on commit a0dd4b4

Please sign in to comment.