A simple browser extension, intended to get you "Back To Work" when you start slacking off to one of those really addictive sites.
36
stars
1
forks
source link
alt: clean JS, better implementation using classes #5
Closed
tusharnankani closed 2 years ago
Review: The code here can be shortened by creating classes and defining styles in the stylesheet.
https://github.com/dheerajdlalwani/back-to-work/blob/fc5c9820ee350dc1ab69f9c9aff77465bc33f979/src/popup/popup.js#L7-L18
It can be shortened more using a default, which I assume is
Chill
. Have the HTML, state & styles initially for that.Have a class for
Work
, and toggle that whenever necessary.Now CSS for work would be something like:
Reason to do that?
Keeps the JS clean and and implementation short. No need for
item.style.backgroundColor
etc.