-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
045eafa
commit a0dd4b4
Showing
23 changed files
with
15,331 additions
and
11,672 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,5 @@ | |
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
.vercel |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.