
Please log in to post a comment
Log in with GitHubCommunity feedback
- P@Rahexx
Great job with this challenge!
Your app looks great and works properly. Here are some suggestions to improve your code structure and readability:
HTML & CSS
-
Class Naming:
Some of your class names are quite long. For instance, instead ofcontainer__form__item__tip__label
, you could simplify it using BEM methodology by using block forform
. For example:
.form__item__tip__label
This makes your code easier to read and maintain. -
Modular SCSS Structure:
Consider organizing your SCSS files by creating a folder likecomponents
and moving specific styles (e.g., for the form) to separate files such as_form.scss
. Then import them into yourmain.scss
.- With nearly 500 lines of styles in one file, it's a good time to break it into smaller, reusable chunks for better maintainability.
- You can also extract common styles, variables, and mixins into separate files.
JavaScript
-
Destructuring:
In cases where you access object properties multiple times, you can use destructuring to improve readability. For example:
const { bill, tip, number_of_people } = data;
This reduces repetition and makes your code cleaner. -
Event Handling:
Great job using event listeners to handle user input dynamically. -
Proxy Implementation:
UsingProxy
to handle state updates and validations is an excellent approach! This keeps your state management clean and ensures all changes go through a central handler.
Final Suggestions
- Extract reusable functions into separate modules/files for better reusability and testability.
- Modularize your CSS/SCSS for easier navigation and maintenance in larger projects.
- Keep up the excellent work with structured and clean JavaScript code! 🎉
Good luck with your next challenges!
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