Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/graph-coins #6

Merged
merged 4 commits into from Mar 8, 2024
Merged

feat/graph-coins #6

merged 4 commits into from Mar 8, 2024

Conversation

bonz88
Copy link
Owner

@bonz88 bonz88 commented Mar 6, 2024

added area and bar graph for displaying bitcoin data. It displays bitcoin data on load, it can change currency based on which currency you select in dropdown. You can hover over chart and price and volume will be displayed based on date. It is hardcoded to display bitcoin but in the next PRs it will be implemented to load a chart based on selected coin in carousel component.

Copy link

vercel bot commented Mar 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cryptofolio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 7, 2024 8:09pm

Copy link
Collaborator

@abhishekjakhar abhishekjakhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both the PriceChart and VolumeChart component are using Similar Logic, do you think we can make a single component and based on the prop render a price or volume chart by reusing most of the logic?

@@ -44,7 +48,10 @@ export default function CarouselCoins() {
key={coin.id}
className="sm:basis-1/2 md:basis-1/3 lg:basis-1/4 xl:basis-1/5"
>
<div className="h-[88px] dark:bg-[#191925] bg-[#FFFFFF] flex items-center rounded-lg cursor-pointer">
<div
onClick={() => handleCarousel(coin.id)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not add onClick on a div, it is semantically not correct. You should replace this div with a button and remove the styling if you don't want styling.

return <div>Error fetching data</div>;
}

const coin = selectedCoins.length > 0 ? selectedCoins[0] : null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can take selectedCoins.length in a variable.

}))
: [];

const handleMouseMove = (e: any) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using any in typescript, it should have proper typing.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed it. I'll push the code soon.


<XAxis dataKey="date" axisLine={false} tickLine={false} />

<Tooltip content={<></>} />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does Tooltip don't have any content?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to display anything in Tooltip because I'm displaying updated price outside chart. When I'm hovering over chart it is updating price number outside chart. Tooltip is used to display information inside chart as a box which is displayed when you hover over chart. If I delete content={<></>} inside tooltip i will have the same information presented twice, price will be displayed as a box inside chart and outside chart because I specified to have a price outside chart with the name of coin and date.

…div with button inside CarouselCoins component
@abhishekjakhar abhishekjakhar merged commit c2dbe4f into main Mar 8, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants