Design comparison
Solution retrospective
Developed the interactive feedback form using HTML, CSS & vanilla JS while maintaining "Mobile First". Fetch advice-slip API to generate advice using pure js logic. Any feedback is appreciated.
Community feedback
- @petritnurediniPosted 10 months ago
Congratulations on completing the Advice Generator App project on Frontend Mentor, Amelia! It's an achievement that showcases your growing skills in web development. Here are a few tips to further enhance your project:
-
Async/Await Error Handling:
-
In your JavaScript
getJSON
function, consider implementing error handling withtry...catch
blocks. This helps to gracefully handle network errors or issues with the API. For instance:const getJSON = async url => { try { const response = await fetch(url); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return await response.json(); } catch (error) { console.error("Fetch error: " + error.message); } }
-
-
CSS Media Query Optimization:
- In your CSS, the media query for mobile devices (
@media only screen and (max-width: 450px)
) can be optimized for better responsive design. Instead of hardcoding the button'sleft
position, consider usingleft: 50%
andtransform: translateX(-50%)
for horizontal centering. This approach is more flexible and adjusts automatically with different screen sizes.
- In your CSS, the media query for mobile devices (
-
Accessibility Improvement:
- Enhance accessibility by adding
aria-label
to your button element. Since the button only has an image, screen readers may not convey its purpose. Anaria-label
likearia-label="Generate new advice"
would be helpful.
- Enhance accessibility by adding
Resources for Learning:
- To deepen your understanding of error handling in JavaScript, visit MDN Web Docs - try...catch.
- Learn more about responsive design and CSS best practices on CSS Tricks.
- For accessibility guidelines, refer to the Web Content Accessibility Guidelines (WCAG).
Keep up the excellent work and continue to challenge yourself with new projects. Your progress is impressive, and each project is a step forward in your front-end development journey! ๐๐
Marked as helpful1@amelia2802Posted 10 months agoThank you @petritnuredini for your tips and resources! Those are really helpful, especially the centering of the button! ๐
0 -
- @Ezekiel225Posted 10 months ago
Hello there ๐ @amelia2802
Good job on completing the challenge !
Your project looks really good!
I have a suggestion about your code that might interest you.
There is an very useful browser extension called Perfect Pixel that allow you compare with the design image and thus see the exact dimensions. I recommend it to you.
I hope this suggestion is useful for future projects.
Other than that, great job!
Happy coding.
Marked as helpful1@amelia2802Posted 10 months agoThank you @Ezekiel225 for suggesting the extension! ๐
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