Design comparison
Solution retrospective
hello! pretty excited about my progress thus far. this challenge gave me a real test and i love it. I added local storage feature. it updates whatever todo you have on the list when you open the browser after closing it. would look into the drag and drop feature later. Any advice/feedback to make my code cleaner and better will be appreciated. Thank you!
Community feedback
- @nelsonleonePosted almost 2 years ago
HELLO,.....congrats on completing the challenge 🎉 🎉 🎉 I saw you repeated code so many times, Here's a tip to write shorter code in case of next solutions you would work on.
I will just stress on the THEME TOGGLE
You don't need to be adding and removing class names, that a lot of code
You can just do that i your css, (one of the ways to tackle it) In your css set a
::root, and another for the theme2
Name the variables the same name , but different value; Then use Js to tell the document body which root variable to use **Hope this was helpful and you found meaning in it . Have fun coding 🎉 🎉 **::root{ --bg-Color: white; -- color:red } .theme2{ --bgColor:black; --color:blue; } **IN YOUR JS** window.onload = document.body.classList.add('.theme1') toggle.addEventlistner('click',() => { if(document.body.classList.contains('theme1'){ document.body.classList.remove('theme1') document.body.classList.add('theme2') } })
1 - @YusfuldevPosted almost 2 years ago
Thank Nelson, I will implement the changes
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