Responsive Mortgage Calculator built with Vue3, TailwindCSS and TS

Solution retrospective
This was an interesting challenge overall. I'm most proud of how I was able to get the input with the extra text into a reuseable component where the developer can specify which side they want the text to be at(left/right). I would definitely use a more cleaner code approach next time.
What challenges did you encounter, and how did you overcome them?I was trying to get the form validations without using any extra state or Javascript code, but It seemed to be harder so I might just change to javascript instead for the validations. Also had a small issue with the enhanced inputs and validations.
What specific areas of your project would you like help with?I would like help with doing the validation manually as using HTML+CSS for the validation was a bit more challenging than expected. Also cleaning up the code and making it more accessible.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @Atatra
Well done, looks clean! :)
Seems like I'm not the only one who tried to factorize the inputs into a single one. Though your code is cleaner than mine. Your CSS solution for hidding/showing the error is interesting.
-
But maybe you could hide the error messages before the user submits the form? It would make the user experience a bit better I think. But you would need to add some javascript.
-
I'm not acquainted with VueJS so it's probably not true (though it doesn't seem so different from NextJS). It looks like you could do it with
@submit
keyword in your<form>
if you correctly named your inputs (see Using Custom Validation . Actually, I did something quite similar here Line 103. My code is ugly, but the idea is the same I suppose. So in your@sumbit
, before calling calculateMortage(), or inside, you could check if the infos are empty string/null. Then update yourformErrors
accordingly. Finally, you will have to extract this array just like you did in MortgageResults. Well, I don't know if there's a simpler solution, or one that only uses HTML+CSS.
(I'm still trying to wrap my head around how you managed to change the radio button's color? It looks so good!!)
Happy coding! :)
-
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