React Challenge #9 Create To DoList (Partial Complete)

 @import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@300&display=swap');


*{
box-sizing: border-box;
padding: 0;
margin: 0;
font-family: 'Josefin Sans', sans-serif;
}



.main_div{

width:100%;
height: 100vh;
background: #6983aa;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}

.center_div{
width:25%;
height:80vh;
background-color:#f4f4f4;
box-shadow: 5px 5px 25px -5px rgba(0,0,0, 0.5);
border-radius: 15px;;
}


h1{
color:white;
background: transparent;
/* text-shadow: 0 2px 2px black; */
background-color: #8566aa;
padding:6px 0 2px 0;
margin-bottom: 10px;
box-shadow: 5px 5px 15px -5px rgba(0,0,0, 0.3);
text-align: center;
font-weight:800;
}

input{

height: 30px;
top: 10px;
border: none;
background: transparent;
font-size: 20px;
font-weight: 500;
width: 60%;
border-bottom: 2px solid #8566aa;
outline: none;
}

button{
min-height: 40px;
width: 40px;
border-radius: 50%;
border-color: transparent;
color: #fff;
font-size: 40px;
border: none;
outline: none;
margin-left: 10px;
box-shadow: 5px 5px 15px -5px rgba(0,0,0, 0.3);
}

button:hover{
background-color:#20bf6b ;
}

ol{
margin-top: 30px;

}

ol li{
padding-left: 0px;
text-align: left;
font-size: 20px;
font-weight: 500;
min-height: 40px;
display: flex;
align-items: center;
color: #8566aa;
text-transform: capitalize;
}

.combine{
display: flex;
flex-direction: row;
justify-content: center;

}

.todo_style{
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}

.todo_style .fa-times{
width: 20px;
height: 20px;
display: flex;
justify-content: center;
align-items: center;
background-color: #8566aa;
border-radius: 50%;
margin:0 15px 0 35px;
color: aliceblue;
box-shadow: 5px 5px 15px -5px rgba(0,0,0, 0.3);

}

.todo_style .fa-times:hover{
color:crimson;
}



import React from 'react';

const ToDoLists =(props)=>{

(
<>
return <li> {props.text}</li>;</>
)

};

export default ToDoLists;


import React, { useState } from 'react';
import ToDoLists from './ToDoLists';

const App = () =>{


const [inputList, setinputList] = useState();
const [Items, setitems] = useState([]);

const itemEvent = (event) =>{

setinputList(event.target.value);

}

const listofItems=()=>{
setitems((oldItems)=>{
return [...oldItems, inputList]
})

setinputList("");

}



return(<>
<div className="main_div">
<div className="center_div">
<br/>
<h1>ToDo List</h1><div className="combine">
<br/>
<input type="text" placeholder="Add a items" onChange={itemEvent} value={inputList}/>
<button onClick={listofItems}>+</button></div>
<ol>
{/* <li> {inputList} </li> */}

{ Items.map((itemVal)=>{
return <ToDoLists text={itemVal}/>;

})}
</ol>



</div>


</div>

</>
)


}

export default App;


v

Comments

Popular posts from this blog

Form Part 2

Event mini project by Thapa#33

De-mystifying 'this' keyword of Javascript