Responsive dynamic chart component using React and Tailwind CSS
Design comparison
Solution retrospective
I'm getting used to Tailwind CSS with React, next time I will be able to create a visually appealing and responsive component more quickly.
What challenges did you encounter, and how did you overcome them?Implementing dynamic data rendering and conditional styling based on the data was the hardest part.
What specific areas of your project would you like help with?I need help with the chart's hover functionality. I haven't been able to ensure that the parent's hover effect of the chart bars does not affect the child's opacity (the div that shows daily expenses on hover). How did you do it?
Community feedback
- @IvanFdez01Posted 3 months ago
Hi, about your problem with hovers:
- You have something like:
<div bar> <div value></div> </div>
This makes that if you apply opacity to bar, then is also applied on value, as they are nested.
- Instead, you can do something like:
<div cont> <div bar></div> <div value></div> </div>
Where, in this case, cont would be the one who has
position:relative
and value would haceposition:absolute
(and special opacity etc). That would separate the styles for bar and value.Good job overall and by the way, what advantages can you obtain by modularizing as much as you have done? Maybe I don't know about frameworks and libraries yet, but is a genuine question as I'm always comfortable in my three .html, .css and .js files, but I see lots of modularized codes.
Cheers friend.
Marked as helpful2@javierdesantPosted 3 months agoHey @IvanFdez01, thanks for the feedback!
I’ll give your tip a shot and send a new solution soon with the bug fixed. I’m also thinking of making it a bit bigger, my solutions always seem to end up smaller than the examples I don't know why.
As for your question, modular code is super handy when you need to reuse it. You can just copy-paste a component from one app to another and not worry about breaking the interface. React libraries are awesome too, that's another reason.
Thanks again for the comment! Have a good one mate.
1@IvanFdez01Posted 3 months ago@javierdesant, he visto que estudias en Madrid, yo también haha.
Sobre el tamaño te diría que no te preocupes ya que son imitaciones de webs en el fondo. Trabaja en las proporciones, eso si.
Te entiendo con los frameworks, muchas gracias me pondré a ello. De todas formas, ¿cómo crees que es mejor empezar con ellos? ¿Cómo lo has hecho tú? Lo único que se es que es un área extensa e impone respeto adentrarse como autodidacta.
Un saludo Javier.
1@javierdesantPosted 3 months ago@IvanFdez01, qué casualidad que también estudies en Madrid jajaj
Sobre tu pregunta de los frameworks, entiendo perfectamente que pueda asustar un poco al principio. Parece mucho, pero es muy similar a lo que ya estás acostumbrado.
Mi consejo sería que empieces con un framework famoso como React y le dieras una oportunidad a TypeScript. Tu CSS ya es muy bueno de por sí, así que no creo que Tailwind te haga falta.
Te dejo el curso con el que yo empecé: Aprende React desde cero: Hooks y State hasta TypeScript, Zod, Zustand, React Query, Next.js, React Router, MERN y PERN
Está en español y el profesor es muy bueno. Con el cupón que te he puesto te debería salir a 10 euros... Mira a ver si te gusta. Si no siempre tienes un montón de cursos y tutoriales en línea que también están bien.
¡Mucho ánimo!
0
Please log in to post a comment
Log in with GitHubJoin 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