-
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
Showing
8 changed files
with
263 additions
and
79 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
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,38 +1,139 @@ | ||
.App { | ||
text-align: center; | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
body { | ||
background-image: linear-gradient(120deg, #f6d365 0%, #fda085 100%); | ||
color: white; | ||
font-family: "Poppins", sans-serif; | ||
min-height: 100vh; | ||
} | ||
header { | ||
font-size: 2rem; | ||
} | ||
|
||
.App-logo { | ||
height: 40vmin; | ||
pointer-events: none; | ||
header, | ||
form { | ||
min-height: 20vh; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
form input, | ||
form button { | ||
padding: 0.5rem; | ||
font-size: 2rem; | ||
border: none; | ||
background: white; | ||
} | ||
form button { | ||
color: #ff6f47; | ||
background: #f7fffe; | ||
cursor: pointer; | ||
transition: all 0.3s ease; | ||
} | ||
form button:hover { | ||
background: #ff6f47; | ||
color: white; | ||
} | ||
.todo-container { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
.App-logo { | ||
animation: App-logo-spin infinite 20s linear; | ||
} | ||
.todo-list { | ||
min-width: 30%; | ||
list-style: none; | ||
} | ||
|
||
.App-header { | ||
background-color: #282c34; | ||
min-height: 100vh; | ||
.todo { | ||
margin: 0.5rem; | ||
background: white; | ||
font-size: 1.5rem; | ||
color: black; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: calc(10px + 2vmin); | ||
transition: all 1s ease; | ||
} | ||
.filter-todo { | ||
padding: 1rem; | ||
} | ||
.todo li { | ||
flex: 1; | ||
} | ||
|
||
.trash-btn, | ||
.complete-btn { | ||
background: #ff6f47; | ||
color: white; | ||
border: none; | ||
padding: 1rem; | ||
cursor: pointer; | ||
font-size: 1rem; | ||
} | ||
.complete-btn { | ||
background: rgb(11, 212, 162); | ||
} | ||
.todo-item { | ||
padding: 0rem 0.5rem; | ||
} | ||
|
||
.fa-trash, | ||
.fa-check { | ||
pointer-events: none; | ||
} | ||
|
||
.App-link { | ||
color: #61dafb; | ||
.fall { | ||
transform: translateY(10rem) rotateZ(20deg); | ||
opacity: 0; | ||
} | ||
|
||
@keyframes App-logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
.completed { | ||
text-decoration: line-through; | ||
opacity: 0.5; | ||
} | ||
|
||
/*CUSTOM SELECTOR */ | ||
select { | ||
-webkit-appearance: none; | ||
-moz-appearance: none; | ||
-ms-appearance: none; | ||
appearance: none; | ||
outline: 0; | ||
box-shadow: none; | ||
border: 0 !important; | ||
background-image: none; | ||
} | ||
|
||
/* Custom Select */ | ||
.select { | ||
margin: 1rem; | ||
position: relative; | ||
overflow: hidden; | ||
} | ||
select { | ||
color: #ff6f47; | ||
font-family: "Poppins", sans-serif; | ||
cursor: pointer; | ||
width: 12rem; | ||
} | ||
/* Arrow */ | ||
.select::after { | ||
content: "\25BC"; | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
padding: 1rem; | ||
background: #ff6f47; | ||
cursor: pointer; | ||
pointer-events: none; | ||
} | ||
/* Transition */ | ||
/* | ||
.select:hover::after { | ||
transform: scale(1.5); | ||
} | ||
*/ |
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
|
||
function Form({ todos, setTodos, inputText, setInputtext, setStatus }){ | ||
function inputTextHandler(e){ | ||
setInputtext(e.target.value) | ||
} | ||
function submitEventHandler(e){ | ||
e.preventDefault(); | ||
setTodos([ | ||
...todos, {text: inputText, completed: false, id: Math.random()*1000} | ||
]); | ||
setInputtext(""); | ||
} | ||
|
||
function statusHandler(e){ | ||
setStatus(e.target.value); | ||
} | ||
return( | ||
<form> | ||
<input value={inputText} onChange = {inputTextHandler} type="text" className="todo-input" /> | ||
<button onClick = {submitEventHandler} className="todo-button" type="submit"> | ||
<i className="fas fa-plus-square"></i> | ||
</button> | ||
<div className="select"> | ||
<select onChange= {statusHandler} name="todos" className="filter-todo"> | ||
<option value="all">All</option> | ||
<option value="completed">Completed</option> | ||
<option value="uncompleted">Uncompleted</option> | ||
</select> | ||
</div> | ||
</form> | ||
|
||
); | ||
} | ||
export default Form; |
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,32 @@ | ||
import React from 'react'; | ||
|
||
function Todo({ text, todo, todos, setTodos }){ | ||
function deletehandler(){ | ||
setTodos(todos.filter((el) => el.id !== todo.id)); | ||
} | ||
function completeHandler(){ | ||
setTodos(todos.map(item => { | ||
if(item.id === todo.id){ | ||
return { | ||
...item, completed: !item.completed | ||
}; | ||
} | ||
return item; | ||
|
||
|
||
})) | ||
}; | ||
return( | ||
<div className='todo'> | ||
<li className={`todo-item ${todo.completed ? "completed" : ''}`}>{text}</li> | ||
<button onClick={completeHandler} className='complete-btn'> | ||
<i className='fas fa-check'></i> | ||
</button> | ||
<button onClick={deletehandler} className='trash-btn'> | ||
<i className='fas fa-trash'></i> | ||
</button> | ||
</div> | ||
); | ||
} | ||
|
||
export default 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from "react"; | ||
import Todo from './Todo'; | ||
|
||
function TodoList( { todos, setTodos, filteredTodos }){ | ||
return(<div className="todo-container"> | ||
<ul className="todo-list"> | ||
{filteredTodos.map((todo) => ( | ||
<Todo setTodos={ setTodos } todos={todos} key={todo.id} todo={todo} text={todo.text} /> | ||
))} | ||
</ul> | ||
</div>); | ||
} | ||
|
||
export default TodoList; |
This file was deleted.
Oops, something went wrong.