Submitted 8 months ago
countries API page (React, react-router-dom, API, SCSS, Vite)
@hassaneljebyly
Design comparison
SolutionDesign
Solution retrospective
What are you most proud of, and what would you do differently next time?
since we can't style I decided to make a custom select menu that works like the native tag, It supports:
- arrow up/down navigation
- when select menu is open preselected element gets focus if it doesn't exists then first element or gets focus
- when Escape or Tab key are pushed it closes the menu while giving focus to menu button
- also dynamic select options
export default function SelectMenu() {
const {
selectedOption,
filterExpanded,
selectOptions,
handleClick,
handleKeyDown,
} = useSelectMenu();
return (
{selectedOption === '' ? 'Filter by Region' : selectedOption}
{selectOptions.map((option) => (
{option}
))}
);
}
What challenges did you encounter, and how did you overcome them?
kept animations until last minutes, wasn't a good idea
Community feedback
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