-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a42604
commit 3e34141
Showing
9 changed files
with
84 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": false, | ||
"singleQuote": true, | ||
"useTabs": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# React ToDo | ||
# React ToDo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import React from "react"; | ||
import ToDoMain from "./components/ToDoMain"; | ||
import React from 'react' | ||
import ToDoMain from './components/ToDoMain' | ||
|
||
function App() { | ||
return ( | ||
<> | ||
<ToDoMain /> | ||
</> | ||
); | ||
) | ||
} | ||
|
||
export default App; | ||
export default App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,80 @@ | ||
import './ToDoMain.css'; | ||
import { useState } from 'react'; | ||
import './ToDoMain.css' | ||
import { useState } from 'react' | ||
|
||
function ToDoMain() { | ||
const [toDo, setToDo] = useState([]); | ||
const [data, setData] = useState(''); | ||
const [toDo, setToDo] = useState([]) | ||
const [data, setData] = useState('') | ||
return ( | ||
<> | ||
<div className='container flex flex-align flex-content'> | ||
<div className='wrapper flex flex-align flex-content flex-wrap'> | ||
<div className='header flex flex-align flex-content flex-dir'> | ||
<div className="container flex flex-align flex-content"> | ||
<div className="wrapper flex flex-align flex-content flex-wrap"> | ||
<div className="header flex flex-align flex-content flex-dir"> | ||
<h1>React ToDo List...</h1> | ||
<div className='input-div flex'> | ||
<div className="input-div flex"> | ||
<input | ||
type='text' | ||
type="text" | ||
onChange={(e) => { | ||
setData(e.target.value); | ||
setData(e.target.value) | ||
}} | ||
placeholder='Enter description' | ||
placeholder="Enter description" | ||
/> | ||
<button | ||
onClick={() => { | ||
setToDo([ | ||
...toDo, | ||
{ des: data, id: Date.now(), check: false }, | ||
]); | ||
}}> | ||
<i className='fa-solid fa-plus fa-xl'></i> | ||
{ | ||
des: data, | ||
id: Date.now(), | ||
check: false, | ||
}, | ||
]) | ||
}} | ||
> | ||
<i className="fa-solid fa-plus fa-xl"></i> | ||
</button> | ||
</div> | ||
</div> | ||
<div className='footer'> | ||
<div className="footer"> | ||
{toDo.map((obj, index) => { | ||
return ( | ||
<div key={index} className='content flex flex-align'> | ||
<div key={index} className="content flex flex-align"> | ||
<input | ||
onClick={(e) => { | ||
setToDo( | ||
toDo.filter((index) => { | ||
if (obj.id === index.id) { | ||
index.status = e.target.checked; | ||
index.status = e.target.checked | ||
} | ||
return index; | ||
return index | ||
}) | ||
); | ||
) | ||
}} | ||
type='checkbox' | ||
type="checkbox" | ||
/> | ||
<div className='content-data flex flex-align flex-content'> | ||
<div className="content-data flex flex-align flex-content"> | ||
<h4>{obj.des}</h4> | ||
</div> | ||
<button | ||
onClick={() => { | ||
setToDo( | ||
toDo.filter((index) => { | ||
if (obj.id != index.id) { | ||
return index; | ||
return index | ||
} | ||
}) | ||
); | ||
}}> | ||
<i className='fa-solid fa-trash fa-xl'></i> | ||
) | ||
}} | ||
> | ||
<i className="fa-solid fa-trash fa-xl"></i> | ||
</button> | ||
</div> | ||
); | ||
) | ||
})} | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
) | ||
} | ||
|
||
export default ToDoMain; | ||
export default ToDoMain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import React from "react"; | ||
import ReactDOM from "react-dom/client"; | ||
import App from "./App"; | ||
import React from 'react' | ||
import ReactDOM from 'react-dom/client' | ||
import App from './App' | ||
|
||
ReactDOM.createRoot(document.getElementById("root")).render( | ||
ReactDOM.createRoot(document.getElementById('root')).render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode> | ||
); | ||
) |