@TKSHII
Submitted
@TKSHII
@TKSHII
Submitted
@TKSHII
Posted
Done in 15 minutes.
@ifedapo4
Submitted
@TKSHII
Posted
You should not use "var" anymore, but "let".
For light and dark mode you have to put an eventListener click on the switch dark/light button. Then you create dark and white class with background: dark for the dark and light for the light.
You select all darkmode changing elements with your JS and put each one in variable. let todoList = document.querySelector('.todolist') etc.. for each.
Then on click on the dark/light button on top it will call a function that will put the dark class to each elements if the theme is dark or light for the light theme.
Thats it :)
Marked as helpful
@lesterdlb
Submitted
I'm not really satisfied with how I handle the update of the Todos after every drag and drop. Basically, every item has an index property, and depending on where the user drops it, I proceed to update every index, by either adding 1 (User moved the item up) or subtracting 1 (User moved the item down), between the original position and the new one. Perhaps a data structure like a linked list could be a better solution?
I'm more of a backend developer, so any feedback regarding how I structured the React application would be appreciated.
@TKSHII
Posted
For the drag and drop i recommend you to check react-dnd or framer-motion :)
@Raul-code1
Submitted
can't do the drag and drop part with framer-motion, if someone can help me on that part it will be awesome.
@TKSHII
Posted
Hey 🙂 For framer motion you have to import { Reorder } from "framer-motion"
Then you create a <Reorder.Group> (its a ul html tag) This Reorder.Group want 3 required params with the value, the axis, and the onReorder one where you put your setState function of your array of data.
Then inside the Reorder.Group you need to put the Reorder.Item (it's an li) with 3 required params I dont remember what it is.
Then it should work :) I did it on mine, go check it out if you need to.
Marked as helpful
@im-victor-mendez
Submitted
I had some problems:
I need to:
@TKSHII
Posted
For a better data flow you should use the context API. Go check my profile, you will see how i did.