Animated & Dynamically Rendered Expenses Chart with CSS GRID

Solution retrospective
A challenge i did while ago, but i've added now some animations on top.
The height of expense bars are dynamically calculated. The bar with highest value is also calculated dynamically and displayed in blue.
Hope you guys like the final result! 🐱
Please log in to post a comment
Log in with GitHubCommunity feedback
- @ArseniyX
Hello, looked around your solution, looks not bad, things to improve:
- use prettier and es-lint to make the code looks better.
- if you use animation library like framer-motion you shouldn't do setTimeout to animation its supposed to be build in with the library you just need to find the right way to do it.
- you not use full potential of react, you need to split big files to small components
- This function:
const findHigh = () => { let max = 0, indx = 0; data.map((item)=>{ return item.amount }).forEach((item, index)=>{ if(item > max) { max = item indx = index } }) return indx }
can be called findHighIndex and you can achieve that with:
const myArray = [5,6,7,2,8,0] const result = myArray.indexOf(Math.max(...myArray)); console.log(result)
Marked as helpful
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord