├── .gitignore ├── README.md ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt ├── src ├── App.css ├── App.js ├── common │ └── card.jsx ├── components │ ├── Header │ │ └── Header.jsx │ ├── images │ │ └── profile.jpeg │ ├── leftSidebar │ │ └── LeftSidbare.js │ └── main │ │ ├── Main.js │ │ ├── Todo.js │ │ └── TodoForm.js ├── index.css └── index.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `yarn start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 13 | 14 | The page will reload if you make edits.\ 15 | You will also see any lint errors in the console. 16 | 17 | ### `yarn test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `yarn build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `yarn eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 35 | 36 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 39 | 40 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 55 | 56 | ### Making a Progressive Web App 57 | 58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 59 | 60 | ### Advanced Configuration 61 | 62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `yarn build` fails to minify 69 | 70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 71 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "todo-list", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@chakra-ui/icons": "^1.0.17", 7 | "@chakra-ui/react": "^1.6.12", 8 | "@emotion/react": "^11", 9 | "@emotion/styled": "^11", 10 | "@testing-library/jest-dom": "^5.11.4", 11 | "@testing-library/react": "^11.1.0", 12 | "@testing-library/user-event": "^12.1.10", 13 | "framer-motion": "^4", 14 | "react": "^17.0.2", 15 | "react-dom": "^17.0.2", 16 | "react-hot-toast": "^2.1.1", 17 | "react-icons": "^4.3.1", 18 | "react-scripts": "4.0.3", 19 | "web-vitals": "^1.0.1" 20 | }, 21 | "scripts": { 22 | "start": "react-scripts start", 23 | "build": "react-scripts build", 24 | "test": "react-scripts test", 25 | "eject": "react-scripts eject" 26 | }, 27 | "eslintConfig": { 28 | "extends": [ 29 | "react-app", 30 | "react-app/jest" 31 | ] 32 | }, 33 | "browserslist": { 34 | "production": [ 35 | ">0.2%", 36 | "not dead", 37 | "not op_mini all" 38 | ], 39 | "development": [ 40 | "last 1 chrome version", 41 | "last 1 firefox version", 42 | "last 1 safari version" 43 | ] 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliturkamanjs/Task-manager/bd0eab5cc4c8ca59154a512bd9b725524ad9c7ea/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | React App 15 | 16 | 17 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliturkamanjs/Task-manager/bd0eab5cc4c8ca59154a512bd9b725524ad9c7ea/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliturkamanjs/Task-manager/bd0eab5cc4c8ca59154a512bd9b725524ad9c7ea/public/logo512.png -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliturkamanjs/Task-manager/bd0eab5cc4c8ca59154a512bd9b725524ad9c7ea/src/App.css -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Header from "./components/Header/Header"; 3 | import LeftSidBar from "./components/leftSidebar/LeftSidbare"; 4 | import Main from "./components/main/Main"; 5 | import { Container, Flex, Box } from "@chakra-ui/react"; 6 | import { useColorMode, useColorModeValue } from "@chakra-ui/color-mode"; 7 | 8 | const App = () => { 9 | const { toggleColorMode } = useColorMode(); 10 | const headerSidBarBg = useColorModeValue("white", "#21212B"); 11 | const headerIconColor = useColorModeValue("#2D3748", "#BCBCBF"); 12 | const BorderColorHeader = useColorModeValue("gray.100", "gray.900"); 13 | const MainBg = useColorModeValue("#f8fafd", "#181820"); 14 | const color = useColorModeValue("gray.700", "gray.300"); 15 | 16 | return ( 17 | <> 18 | 26 |
32 | 33 | 37 | 42 | 43 | 44 | 45 |
52 | 53 | 54 | 55 | 56 | ); 57 | }; 58 | 59 | export default App; 60 | -------------------------------------------------------------------------------- /src/common/card.jsx: -------------------------------------------------------------------------------- 1 | import { Box } from "@chakra-ui/layout"; 2 | import React from "react"; 3 | 4 | const Card = ({ children, ...rest }) => { 5 | return ( 6 | 16 | {children} 17 | 18 | ); 19 | }; 20 | 21 | export default Card; 22 | -------------------------------------------------------------------------------- /src/components/Header/Header.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import profileImage from "../images/profile.jpeg"; 3 | 4 | import { Flex } from "@chakra-ui/react"; 5 | import { Link, Text } from "@chakra-ui/layout"; 6 | import { Avatar, AvatarBadge } from "@chakra-ui/avatar"; 7 | import { Button } from "@chakra-ui/button"; 8 | import { MdSpaceDashboard } from "react-icons/md"; 9 | import { IoFolderOpen } from "react-icons/io5"; 10 | import { RiSearch2Line } from "react-icons/ri"; 11 | import { CgSun } from "react-icons/cg"; 12 | import { CgMenu } from "react-icons/cg"; 13 | 14 | const Header = ({ 15 | toggleColorMode, 16 | headerSidBarBg, 17 | headerIconColor, 18 | BorderColorHeader, 19 | }) => { 20 | return ( 21 | 34 | 35 | 45 | 63 | 79 | 80 | 81 | 82 | 92 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | ); 103 | }; 104 | 105 | export default Header; 106 | -------------------------------------------------------------------------------- /src/components/images/profile.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aliturkamanjs/Task-manager/bd0eab5cc4c8ca59154a512bd9b725524ad9c7ea/src/components/images/profile.jpeg -------------------------------------------------------------------------------- /src/components/leftSidebar/LeftSidbare.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | import { Box, Flex, Heading, Spacer, Text, VStack } from "@chakra-ui/layout"; 4 | import { Button } from "@chakra-ui/button"; 5 | import { TiUser } from "react-icons/ti"; 6 | import { IoBook } from "react-icons/io5"; 7 | import { RiComputerFill } from "react-icons/ri"; 8 | import { MdShoppingCart } from "react-icons/md"; 9 | import { SiAddthis } from "react-icons/si"; 10 | 11 | const LeftSidBar = ({ headerSidBarBg, MainBg, headerIconColor }) => { 12 | return ( 13 | 23 | 24 | 31 | Collections 32 | 33 | 34 | 50 | 57 | 58 | 59 | 64 | Personal 65 | 66 | 67 | 68 | 84 | 91 | 92 | 93 | 98 | School 99 | 100 | 101 | 102 | 117 | 124 | 125 | 126 | 131 | Work 132 | 133 | 134 | 135 | 150 | 157 | 158 | 159 | 164 | Groceries 165 | 166 | 167 | 168 | 169 | 182 | 183 | ); 184 | }; 185 | 186 | export default LeftSidBar; 187 | -------------------------------------------------------------------------------- /src/components/main/Main.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from "react"; 2 | import Card from "../../common/card"; 3 | import TodoForm from "./TodoForm"; 4 | import Todo from "./Todo"; 5 | 6 | import { Box, Container, Flex, Heading } from "@chakra-ui/layout"; 7 | import { IoChevronBackOutline } from "react-icons/io5"; 8 | import { BsThreeDots } from "react-icons/bs"; 9 | import { MdAdd } from "react-icons/md"; 10 | import { useDisclosure } from "@chakra-ui/react"; 11 | 12 | import toast, { Toaster } from "react-hot-toast"; 13 | 14 | const Main = ({ 15 | MainBg, 16 | headerSidBarBg, 17 | color, 18 | BorderColorHeader, 19 | headerIconColor, 20 | }) => { 21 | const { isOpen, onOpen, onClose } = useDisclosure(); 22 | const [todos, setTodos] = useState([]); 23 | 24 | const notify = () => toast 25 | 26 | useEffect(() => { 27 | getTodosLs(); 28 | }, []); 29 | 30 | useEffect(() => { 31 | addTodosLs(); 32 | }, [todos]); 33 | 34 | const addTodo = (todo) => { 35 | if (!todo._title || !todo._desc || /^\s*$/.test(todo._title, todo._desc)) { 36 | notify().error("Please enter all fields"); 37 | return; 38 | } 39 | 40 | const newTodo = [todo, ...todos]; 41 | setTodos(newTodo); 42 | notify().success("Task added 🥳"); 43 | }; 44 | 45 | const updateTodo = (todoId, newValue) => { 46 | if ( 47 | !newValue._title || 48 | !newValue._desc || 49 | /^\s*$/.test(newValue._title, newValue._desc) 50 | ) { 51 | return; 52 | } 53 | 54 | setTodos((prev) => 55 | prev.map((item) => (item.id === todoId ? newValue : item)) 56 | ); 57 | notify().success("Updated 💥"); 58 | }; 59 | 60 | const isComplete = (id) => { 61 | let completedTodo = todos.map((todo) => { 62 | if (todo.id === id) { 63 | todo.isComplete = !todo.isComplete; 64 | } 65 | return todo; 66 | }); 67 | setTodos(completedTodo); 68 | }; 69 | 70 | const delteTodo = (id) => { 71 | const updatedTodos = todos.filter((todo) => todo.id !== id); 72 | setTodos(updatedTodos); 73 | }; 74 | 75 | const addTodosLs = () => { 76 | localStorage.setItem("todos", JSON.stringify(todos)); 77 | }; 78 | 79 | const getTodosLs = () => { 80 | let TodosLs = localStorage.getItem("todos"); 81 | if (TodosLs === null) { 82 | localStorage.setItem("todos", JSON.stringify([])); 83 | } else { 84 | let getTodos = JSON.parse(localStorage.getItem("todos")); 85 | setTodos(getTodos); 86 | } 87 | }; 88 | 89 | return ( 90 | 91 | 92 | 103 | 109 | 110 | 124 | 125 | 126 | 127 | Personal 128 | 129 | 130 | 131 | 139 | 140 | 141 | 142 | 143 | 153 | 164 | 165 | 166 | 167 | Add New Task 168 | 169 | 170 | 178 | 191 | 192 | 193 | ); 194 | }; 195 | 196 | export default Main; 197 | -------------------------------------------------------------------------------- /src/components/main/Todo.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { Box, Flex, Heading, Text } from "@chakra-ui/layout"; 3 | import toast, { Toaster } from "react-hot-toast"; 4 | 5 | import { 6 | Accordion, 7 | AccordionItem, 8 | AccordionButton, 9 | AccordionPanel, 10 | AccordionIcon, 11 | Menu, 12 | MenuButton, 13 | MenuList, 14 | MenuItem, 15 | Button, 16 | Divider, 17 | } from "@chakra-ui/react"; 18 | import { HiCheck } from "react-icons/hi"; 19 | import { BsThreeDots } from "react-icons/bs"; 20 | import { BiEdit, BiTrash } from "react-icons/bi"; 21 | import TodoForm from "./TodoForm"; 22 | 23 | const Todo = ({ 24 | todos, 25 | isComplete, 26 | removeTodo, 27 | updateTodo, 28 | onOpen, 29 | isOpen, 30 | onClose, 31 | headerSidBarBg, 32 | color, 33 | BorderColorHeader, 34 | headerIconColor, 35 | }) => { 36 | const notify = () => toast.success("Completed 🎉"); 37 | const [edit, setEdit] = useState({ 38 | id: null, 39 | value: "", 40 | desc: "", 41 | }); 42 | 43 | const submitHandler = (value) => { 44 | updateTodo(edit.id, value); 45 | setEdit({ 46 | id: null, 47 | value: "", 48 | desc: "", 49 | }); 50 | }; 51 | 52 | if (edit.id) { 53 | return ( 54 | 60 | ); 61 | } 62 | 63 | return ( 64 | 65 | 0 ? "block" : "none"} 70 | > 71 | Tasks {todos.length} 72 | 73 | {todos.map((todo) => { 74 | return ( 75 | 84 | 85 | 86 | 87 | { 100 | isComplete(todo.id); 101 | if (todo.isComplete) { 102 | notify(); 103 | } 104 | }} 105 | > 106 | {todo.isComplete ? : null} 107 | 108 | 109 | 115 | 121 | {todo._title} 122 | 123 | 124 | 125 | 126 | 127 | } 136 | > 137 | 138 | } 141 | onClick={() => { 142 | onOpen(); 143 | setEdit({ 144 | id: todo.id, 145 | value: todo._title, 146 | desc: todo._desc, 147 | }); 148 | }} 149 | > 150 | Edit 151 | 152 | 153 | } 155 | color="red.400" 156 | onClick={() => removeTodo(todo.id)} 157 | > 158 | Delete 159 | 160 | 161 | 162 | 163 | 164 | {todo._desc} 165 | 166 | 167 | 168 | 169 | ); 170 | })} 171 | 172 | ); 173 | }; 174 | 175 | export default Todo; 176 | -------------------------------------------------------------------------------- /src/components/main/TodoForm.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | 3 | import { 4 | Modal, 5 | ModalOverlay, 6 | ModalContent, 7 | ModalHeader, 8 | ModalBody, 9 | Button, 10 | FormControl, 11 | FormLabel, 12 | Flex, 13 | } from "@chakra-ui/react"; 14 | import { Input } from "@chakra-ui/input"; 15 | 16 | 17 | const TodoForm = ({ onClose, isOpen, onsubmit, edit, headerSidBarBg, color }) => { 18 | const [title, setTitle] = useState(edit ? edit.value : ''); 19 | const [desc, setDesc] = useState(edit ? edit.desc : ''); 20 | 21 | const titleHandler = (e) => { 22 | setTitle(e.target.value); 23 | }; 24 | 25 | const descHandler = (e) => { 26 | setDesc(e.target.value); 27 | }; 28 | 29 | const submitHandler = (e) => { 30 | e.preventDefault(); 31 | 32 | onsubmit({ 33 | id: Math.floor(Math.random() * 1282372837287), 34 | _title: title, 35 | _desc: desc, 36 | }); 37 | 38 | setTitle(""); 39 | setDesc(""); 40 | }; 41 | 42 | return ( 43 | <> 44 | 45 | 51 | 52 | 53 | {edit ? "Update Task" : "Add a Todo"} 54 | 55 |
56 | 57 | 58 | {edit ? "Update your title" : "Enter your title"} 59 | 60 | 66 | 67 | 68 | 69 | 70 | {edit ? "Update description" : "Description"} 71 | 72 | 78 | 79 | 80 | 83 | 94 | 95 |
96 |
97 |
98 |
99 | 100 | ); 101 | }; 102 | 103 | export default TodoForm; 104 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | #root{ 2 | height: 100vh; 3 | } 4 | 5 | ::-webkit-scrollbar { 6 | width: 0px; 7 | } 8 | 9 | /* Track */ 10 | ::-webkit-scrollbar-track { 11 | background: #f1f1f1; 12 | } 13 | 14 | /* Handle */ 15 | ::-webkit-scrollbar-thumb { 16 | background: rgb(95, 95, 95); 17 | } 18 | 19 | /* Handle on hover */ 20 | ::-webkit-scrollbar-thumb:hover { 21 | background: #555; 22 | } 23 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import App from "./App"; 4 | import { ChakraProvider } from "@chakra-ui/react"; 5 | import "./index.css"; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | 11 | 12 | , 13 | document.getElementById("root") 14 | ); 15 | --------------------------------------------------------------------------------