Responsive Page using Tailwindcss and React.js

Solution retrospective
Who knows how to make the dropdown better?
Please log in to post a comment
Log in with GitHubCommunity feedback
- @ABojo
The project looks awesome, and you did a great job. I’ll try my best to help you with the dropdown issue you’re having.
First, you want to give the dropdown buttons a position of relative. If you do that, each dropdown box will be positioned according to its parent dropdown button.
You’d want each dropdown button to have the relative class like this:
<li class="relative gap-1 flex justify-between items-center">
Second, clicking any dropdown button will cause all of the dropdowns to be toggled at the same time, but you want each dropdown to be toggled separately. I looked at your code and each dropdown box is being toggled by the same piece of state. I would make a dropdown component, so each instance will have its own isOpen state, and that way only the correct dropdown will be opened.
Also, it’s important to use a button element for your dropdown buttons because they come with important accessibility features included.
If you need any more help, let me know!
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