Design comparison
Solution retrospective
I created a component to display each of the summaries (reaction, memory, verbal, visual) but I had to then use four components each with different props to achieve the desired look. Is there a better way of structuring the component to display the necessary information without duplicating four components each with slightly different props?
Community feedback
- @markuslewinPosted over 1 year ago
Instead of filtering the data array inside
<Summary>
, you could iterate over the array in<Home>
, like this:<h3 className="text-lg text-black pb-4">Summary</h3>; { data.scores.map((score) => { return <Summary key={score.category} {...score} />; }); }
The colors could be stored in an object with the category as a key:
const colorsByCategory = { Reaction: { bgColor: "bg-red-100", textColor: "text-red-600", }, /* ... */ };
Or, you could style the items using data modifiers:
<div className="data-[category=Reaction]:bg-red-100 data-[category=Reaction]:text-red-600 ..." data-category={category} >
Marked as helpful1@FLuffy-teddyPosted over 1 year ago@markuslewin
Thanks for the response, actually very useful for this next project I am tackling.
1 - @NehalSahu8055Posted over 1 year ago
Hello Coder 👋.
Congratulations on successfully completing the challenge! 🎉
Few suggestions regarding design.
➨ Replace
height:100vh
withmin-height:100vh
incontainer
..h-screen { min-height: 100vh; }
➨ Give your
container
some width or more specificmax-width
as it become very large on larger screens.➨ You can use
accessibility features
likearia, sr-only, and title
which are accessible to screen readers.I hope you find this helpful.
Happy coding😄
Marked as helpful1
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