-
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
18 changed files
with
713 additions
and
884 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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,38 +0,0 @@ | ||
.App { | ||
text-align: center; | ||
} | ||
|
||
.App-logo { | ||
height: 40vmin; | ||
pointer-events: none; | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
.App-logo { | ||
animation: App-logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.App-header { | ||
background-color: #282c34; | ||
min-height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: calc(10px + 2vmin); | ||
color: white; | ||
} | ||
|
||
.App-link { | ||
color: #61dafb; | ||
} | ||
|
||
@keyframes App-logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
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 { FaPlus } from 'react-icons/fa'; | ||
import {useRef} from 'react'; | ||
|
||
|
||
const AddItem = ({newItem, setnewItem, handleSubmit}) => { | ||
|
||
const inputRef = useRef(); | ||
|
||
return ( | ||
<main className='addItem'> | ||
<form onSubmit={handleSubmit}> | ||
<label htmlFor="add">Add Item</label> | ||
<input | ||
maxLength="100" | ||
id="add" | ||
type="text" | ||
placeholder="add item" | ||
autoFocus | ||
ref={inputRef} | ||
required | ||
value={newItem} | ||
onChange={(e)=>setnewItem(e.target.value)} | ||
/> | ||
<button | ||
type="submit" | ||
aria-label="add-item" | ||
onClick={()=>inputRef.current.focus()}> | ||
<FaPlus /> | ||
</button> | ||
</form> | ||
</main> | ||
); | ||
} | ||
|
||
export default AddItem; |
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,56 @@ | ||
import {AiOutlineEdit} from 'react-icons/ai' | ||
import {MdDeleteForever} from 'react-icons/md' | ||
import AddItem from './AddItem'; | ||
import Search from './Search'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
|
||
|
||
const Content = ({items, handleCheck, handleDelete, newItem, setnewItem, handleSubmit, search, setSearch}) => { | ||
|
||
|
||
|
||
return ( | ||
<main className="Content"> | ||
<Search | ||
search={search} | ||
setSearch={setSearch} | ||
/> | ||
<AddItem | ||
newItem={newItem} | ||
setnewItem={setnewItem} | ||
handleSubmit={handleSubmit} | ||
/> | ||
{items.length ? | ||
(<ul> | ||
{items.map( | ||
(item) => ( | ||
<li className="list" key={item.id}> | ||
<input | ||
type="checkbox" | ||
checked = {item.checked} | ||
onChange={()=>handleCheck(item.id)} | ||
/> | ||
<label | ||
className='listInput' | ||
onDoubleClick={()=>handleCheck(item.id)} | ||
style={(item.checked) ? {textDecoration:'line-through'} : null} | ||
>{item.data} | ||
</label> | ||
<div className='buttons'> | ||
<button className="edit"><Link to="edit"><AiOutlineEdit/></Link></button> | ||
<button | ||
className="delete" | ||
onClick={()=>handleDelete(item.id)}> | ||
<MdDeleteForever/> | ||
</button> | ||
</div> | ||
</li> | ||
) | ||
)} | ||
</ul>) : <p style={{marginTop:'20vh', fontWeight:'bold'}}>Your list is empty!</p>} | ||
</main> | ||
); | ||
} | ||
|
||
export default Content; |
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,37 @@ | ||
import { Link, useParams } from "react-router-dom"; | ||
|
||
|
||
|
||
const Edit = ({items, editPost, setEditPost, handleEdit}) => { | ||
|
||
const {id} = useParams(); | ||
const item = items.find(item => (item.id).toString() === id) | ||
|
||
|
||
return ( | ||
<main className="Edit"> | ||
<form onSubmit={(e)=>e.preventDefault()}> | ||
<label htmlFor="postTitle">Edit Post</label> | ||
<input | ||
id="postTitle" | ||
placeholder="enter new name" | ||
type="text" | ||
value={editPost} | ||
onChange={(e)=>setEditPost(e.target.value)} | ||
required | ||
autoFocus | ||
/> | ||
<button | ||
type="submit" | ||
aria-label="edit-item" | ||
onClick={()=>handleEdit(item.id)} | ||
> | ||
Submit | ||
</button> | ||
</form> | ||
<Link to="/"><button className="cancel">Cancel</button></Link> | ||
</main> | ||
); | ||
} | ||
|
||
export default Edit; |
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,9 @@ | ||
const Footer = ({items}) => { | ||
return ( | ||
<main className="Footer"> | ||
<p>{items.length} list {items.length <=1 ? 'item' : 'items'}</p> | ||
</main> | ||
); | ||
} | ||
|
||
export default Footer; |
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,15 @@ | ||
|
||
|
||
const Header = ({title}) => { | ||
return ( | ||
<main className="Header"> | ||
<h2>{title}</h2> | ||
</main> | ||
); | ||
} | ||
|
||
Header.defaultProps ={ | ||
title: 'Default Title' | ||
} | ||
|
||
export default Header; |
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,12 @@ | ||
import { Link } from "react-router-dom"; | ||
|
||
const Missing = () => { | ||
return ( | ||
<main className="Missing"> | ||
<h3>Page does not exist</h3> | ||
<p><Link to="/">Go Home</Link></p> | ||
</main> | ||
); | ||
} | ||
|
||
export default Missing; |
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,29 @@ | ||
|
||
|
||
|
||
|
||
const Search = ({search, setSearch}) => { | ||
|
||
|
||
|
||
return ( | ||
<main> | ||
<form | ||
className="search" | ||
onSubmit={(e)=>e.preventDefualt()} | ||
> | ||
<label htmlFor="search">Search</label> | ||
<input | ||
id="search" | ||
type="text" | ||
role="searchbox" | ||
placeholder="search items" | ||
input={search} | ||
onChange={(e) => setSearch(e.target.value)} | ||
/> | ||
</form> | ||
</main> | ||
); | ||
} | ||
|
||
export default Search; |
Oops, something went wrong.