-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Project to-do-list #450
Open
AndreaHedstrom
wants to merge
58
commits into
Technigo:master
Choose a base branch
from
AndreaHedstrom:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Project to-do-list #450
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
28e4fe4
first structure
2ae70ec
added components
66da93e
added form and submitbtn
78f33e2
installed styled-components and uniqid
61bbe16
updated names for components
30ffb0f
small changes
513709a
added Header
9bd2af7
installed uuid
74a9282
finally see the tasks
29493ac
added som styled components
e81fbc5
changed the filtering
4925b0a
got the filtering to work
2b8a110
started with styling
c8c1116
added weather-icon
b8dca69
worked on the styling
356c3da
tried different backgrounds
56cf766
..
5724917
fix the delete button
3346bed
...
dbcb4eb
font color
91497b8
..
3c48c5a
fix
ee43446
added icon
c2a0284
..
c52c675
margins
2897686
new font
d3f74b1
small fix
411d8a1
got the deleting to work again
b7587ce
media queries
64ddec7
margins
f77eb07
margins
438ba76
margins
f793f33
margins
82d9fec
margins
a77390a
removed icon
0c87ecd
started with footer
bc52522
changed color
ad4e3fb
margin
c76de46
..
d0bf2af
gap
0d31386
changed colors
624b972
added new icon
3da6458
bigger button
7206ead
changed gap
6403579
button size to make icon visible
2d31e6b
color
112a774
button size
e98355c
..
f12d462
color
8c074da
added media queries
4f33885
new colors
fea54c8
background
59e8b73
small fix
82b18be
margins for headers
81fdd6d
margins
5b66fc6
margins
a987e24
margins again
6d5ec12
margins
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,25 @@ | ||
import React from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import { combineReducers, configureStore } from '@reduxjs/toolkit'; | ||
import tasks from 'components/reducers/tasks'; | ||
import AddTask from 'components/AddTask'; | ||
import TaskList from 'components/TaskList'; | ||
import Header from 'components/Header'; | ||
import Footer from 'components/Footer'; | ||
|
||
const reducer = combineReducers({ | ||
tasks: tasks.reducer | ||
}) | ||
|
||
const store = configureStore({ reducer }); | ||
|
||
export const App = () => { | ||
return ( | ||
<div> | ||
Find me in src/app.js! | ||
</div> | ||
); | ||
<Provider store={store}> | ||
<Header /> | ||
<AddTask /> | ||
<TaskList /> | ||
<Footer /> | ||
</Provider> | ||
) | ||
} |
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,70 @@ | ||
import React, { useState } from 'react'; | ||
import { useDispatch } from 'react-redux'; | ||
import tasks from 'components/reducers/tasks'; | ||
import styled from 'styled-components'; | ||
|
||
const InnerWrapper = styled.div` | ||
display: flex; | ||
flex-directon: row; | ||
justify-content: center; | ||
align-items: center; | ||
` | ||
const Label = styled.div` | ||
font-size: 20px; | ||
` | ||
|
||
const Input = styled.input` | ||
width: 200px; | ||
height: 30px; | ||
border-radius: 5px; | ||
border: solid rgb(86, 113, 143); | ||
margin-right: 10px; | ||
font-size: 18x; | ||
` | ||
|
||
const SubmitBtn = styled.button` | ||
width: 50px; | ||
height: 40px; | ||
margin-left: -9px; | ||
border-style: none; | ||
background-color: rgb(187, 205, 226); | ||
font-size: 15px; | ||
color: rgb(86, 113, 143); | ||
position: absolute; | ||
` | ||
const AddTask = () => { | ||
const [inputValue, setInputValue] = useState('') | ||
const dispatch = useDispatch() | ||
const onFormSubmit = (event) => { | ||
event.preventDefault(); | ||
const newTask = { | ||
id: Date.now().toString(), | ||
text: inputValue, | ||
complete: false | ||
} | ||
dispatch(tasks.actions.addTask(newTask)); | ||
setInputValue(''); | ||
} | ||
|
||
return ( | ||
<InnerWrapper> | ||
<form onSubmit={onFormSubmit}> | ||
<Label htmlFor="addInput"> | ||
<Input | ||
value={inputValue} | ||
type="text" | ||
placeholder="Don't forget to bring..." | ||
onChange={(event) => setInputValue(event.target.value)} | ||
id="addInput" /> | ||
<SubmitBtn type="submit" disabled={inputValue.length === 0}> | ||
<span className="material-symbols-outlined"> | ||
local_mall | ||
</span> | ||
</SubmitBtn> | ||
</Label> | ||
</form> | ||
</InnerWrapper> | ||
) | ||
} | ||
|
||
export default AddTask; | ||
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,23 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
const FooterWrapper = styled.div` | ||
margin-top: 80px; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
color: rgb(86, 113, 143); | ||
font-size: 10px; | ||
font-family: 'Quicksand', sans-serif; | ||
` | ||
|
||
const Footer = () => { | ||
return ( | ||
<FooterWrapper> | ||
<h2>Designed by Andrea Hedström 2023</h2> | ||
</FooterWrapper> | ||
) | ||
} | ||
|
||
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,43 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
const HeaderWrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
` | ||
|
||
const HeaderText = styled.div` | ||
font-size: 21px; | ||
font-family: 'Quicksand', sans-serif; | ||
color: rgb(86, 113, 143); | ||
height: 100px; | ||
margin-bottom: 10px; | ||
margin-top: 25px; | ||
` | ||
const Weather = styled.div` | ||
font-size: 18px; | ||
font-famiy: 'Quicksand', sans-serif; | ||
margin-bottom: 20px; | ||
letter-spacing: 5px; | ||
color: white; | ||
` | ||
|
||
export const Header = () => { | ||
return ( | ||
<HeaderWrapper> | ||
<HeaderText> | ||
<h1>Back & forth list</h1> | ||
</HeaderText> | ||
<Weather> | ||
It's | ||
<span className="material-symbols-outlined"> | ||
rainy | ||
</span> today. | ||
</Weather> | ||
</HeaderWrapper> | ||
) | ||
} | ||
|
||
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,132 @@ | ||
import React from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import tasks from 'components/reducers/tasks'; | ||
import styled from 'styled-components'; | ||
|
||
const List = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
margin-top: 20px; | ||
` | ||
const ListHeader = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
gap: 130px; | ||
justify-content: center; | ||
font-size: 15px; | ||
font-family: 'Montserrat', sans-serif; | ||
margin-bottom: -10px; | ||
color: white; | ||
|
||
` | ||
const ListHeaderHome = styled.div` | ||
display: flex; | ||
align-items: flex-start; | ||
margin-left: 32px; | ||
font-size: 15px; | ||
font-family: 'Montserrat', sans-serif; | ||
margin-bottom: -10px; | ||
color: white; | ||
@media (min-width: 768px) { | ||
align-self: center; | ||
} | ||
` | ||
|
||
const InnerWrapper = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: center; | ||
font-size: 18px; | ||
margin: 4px 30px 4px 30px; | ||
gap: 40px; | ||
font-family: 'Quicksand', sans-serif; | ||
color: rgb(69, 92, 107); | ||
[type="checkbox"]{ | ||
width: 25px; | ||
height: 25px; | ||
} | ||
` | ||
|
||
const TaskText = styled.div` | ||
width: 200px; | ||
margin-left: -20px; | ||
` | ||
|
||
const DeleteBtn = styled.button` | ||
background-color: rgb(187, 205, 226); | ||
font-size: 20px; | ||
font-family: 'Quicksand', sans-serif; | ||
width: 50px; | ||
height: 40px; | ||
margin-left: 60px; | ||
color: rgb(86, 113, 143); | ||
border-style: none; | ||
` | ||
|
||
const TaskList = () => { | ||
const taskList = useSelector((store) => store.tasks.items) | ||
const dispatch = useDispatch(); | ||
const taskToDo = taskList.filter((task) => !task.isChecked) | ||
const completedTask = taskList.filter((task) => task.isChecked) | ||
/* const onDeleteTaskBtn = (id) => { | ||
dispatch(tasks.actions.deleteTask(id)); | ||
} */ | ||
|
||
return ( | ||
<List> | ||
<ListHeader><h2>Preschool</h2><h2>Put in ↓</h2> | ||
</ListHeader> | ||
{completedTask.map((task) => { | ||
return ( | ||
<InnerWrapper> | ||
<label htmlFor={task.id}> | ||
<input | ||
key={task.id} | ||
type="checkbox" | ||
checked={task.isChecked} | ||
onChange={() => dispatch(tasks.actions.toggleItem(task))} /> | ||
</label> | ||
<TaskText> | ||
{task.text} | ||
</TaskText> | ||
<DeleteBtn | ||
type="button" | ||
onClick={() => dispatch(tasks.actions.deleteTask(task))}> | ||
<span className="material-symbols-outlined"> | ||
local_laundry_service | ||
</span> | ||
</DeleteBtn> | ||
</InnerWrapper> | ||
) | ||
})} | ||
<ListHeaderHome><h2>Home</h2> | ||
</ListHeaderHome> | ||
{taskToDo.map((task) => { | ||
return ( | ||
<InnerWrapper> | ||
<label htmlFor={task.id}> | ||
<input | ||
type="checkbox" | ||
checked={task.isChecked} | ||
key={task.id} | ||
onChange={() => dispatch(tasks.actions.toggleItem(task))} /> | ||
</label> | ||
<TaskText> | ||
{task.text} | ||
</TaskText> | ||
<DeleteBtn | ||
type="button" | ||
onClick={() => dispatch(tasks.actions.deleteTask(task))}> | ||
<span className="material-symbols-outlined"> | ||
local_laundry_service | ||
</span> | ||
</DeleteBtn> | ||
</InnerWrapper> | ||
) | ||
})} | ||
Comment on lines
+80
to
+127
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe the return from mapping of completedTask and TaskToDo could have been a reusable component since they return the same type of content? |
||
</List> | ||
) | ||
} | ||
|
||
export default TaskList; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well structured and easy to read!