This is a solution to the Dictionary web app challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- Search for words using the input field
- See the Free Dictionary API's response for the searched word
- See a form validation message when trying to submit a blank form
- Play the audio file for a word when it's available
- Switch between serif, sans serif, and monospace fonts
- Switch between light and dark themes
- View the optimal layout for the interface depending on their device's screen size
- See hover and focus states for all interactive elements on the page
- Bonus: Have the correct color scheme chosen for them based on their computer preferences. Hint: Research
prefers-color-scheme
in CSS.
- Live Site URL: Here
- Semantic HTML5 markup
- Mobile-first workflow
- React - JS library
- Dictionary API - For the definition data
- CSS Modules - For styles
I learned a few new things during this project
- Custom dropdown box and toggle switch
- Working with audio object for definition pronunciation
Some of the words from the api did not include an audio source, so I learned that the play()
method returns a promise so it made catching errors simpler
audioSrc.play().catch(error => console.log('No audio source'));
I want to look into react context, because I noticed I was passing down the same state through multiple components and in my opinion it started to get a bit messy.
- Article by Thi Tran - This article gave me some inspiration on how to go about creating a custom dropdown menu for the font selector. It also helped with the logic for closing the dropdown when the area outside of it was clicked.
- Frontend Mentor - @adkenney
- LinkedIn - @arkellkenney