Skip to content
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
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
28e4fe4
first structure
Apr 19, 2023
2ae70ec
added components
Apr 20, 2023
66da93e
added form and submitbtn
Apr 20, 2023
78f33e2
installed styled-components and uniqid
Apr 20, 2023
61bbe16
updated names for components
Apr 21, 2023
30ffb0f
small changes
Apr 21, 2023
513709a
added Header
Apr 21, 2023
9bd2af7
installed uuid
Apr 21, 2023
74a9282
finally see the tasks
Apr 21, 2023
29493ac
added som styled components
Apr 21, 2023
e81fbc5
changed the filtering
Apr 22, 2023
4925b0a
got the filtering to work
Apr 22, 2023
2b8a110
started with styling
Apr 22, 2023
c8c1116
added weather-icon
Apr 23, 2023
b8dca69
worked on the styling
Apr 23, 2023
356c3da
tried different backgrounds
Apr 23, 2023
56cf766
..
Apr 23, 2023
5724917
fix the delete button
Apr 23, 2023
3346bed
...
Apr 23, 2023
dbcb4eb
font color
Apr 23, 2023
91497b8
..
Apr 23, 2023
3c48c5a
fix
Apr 23, 2023
ee43446
added icon
Apr 24, 2023
c2a0284
..
Apr 24, 2023
c52c675
margins
Apr 24, 2023
2897686
new font
Apr 24, 2023
d3f74b1
small fix
Apr 24, 2023
411d8a1
got the deleting to work again
Apr 24, 2023
b7587ce
media queries
Apr 24, 2023
64ddec7
margins
Apr 24, 2023
f77eb07
margins
Apr 24, 2023
438ba76
margins
Apr 24, 2023
f793f33
margins
Apr 24, 2023
82d9fec
margins
Apr 24, 2023
a77390a
removed icon
Apr 24, 2023
0c87ecd
started with footer
Apr 24, 2023
bc52522
changed color
Apr 24, 2023
ad4e3fb
margin
Apr 24, 2023
c76de46
..
Apr 24, 2023
d0bf2af
gap
Apr 24, 2023
0d31386
changed colors
Apr 24, 2023
624b972
added new icon
Apr 24, 2023
3da6458
bigger button
Apr 24, 2023
7206ead
changed gap
Apr 24, 2023
6403579
button size to make icon visible
Apr 24, 2023
2d31e6b
color
Apr 24, 2023
112a774
button size
Apr 24, 2023
e98355c
..
Apr 24, 2023
f12d462
color
Apr 24, 2023
8c074da
added media queries
Apr 24, 2023
4f33885
new colors
Apr 24, 2023
fea54c8
background
Apr 24, 2023
59e8b73
small fix
Apr 24, 2023
82b18be
margins for headers
Apr 25, 2023
81fdd6d
margins
Apr 25, 2023
5b66fc6
margins
Apr 25, 2023
a987e24
margins again
Apr 25, 2023
6d5ec12
margins
Apr 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added code/assets/Namnlös design (5).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added code/assets/Namnlös design (6).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
619 changes: 568 additions & 51 deletions code/package-lock.json

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
"version": "1.0.0",
"private": true,
"dependencies": {
"@babel/eslint-parser": "^7.18.9",
"@reduxjs/toolkit": "^1.9.5",
"eslint": "^8.21.0",
"eslint-config-airbnb": "^19.0.4",
"parser": "@babel/eslint-parser",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-redux": "^8.0.5",
"styled-components": "^5.3.9",
"uniqid": "^5.4.0",
"uuid": "^9.0.0"
},
"scripts": {
"start": "react-scripts start",
Expand All @@ -33,6 +38,7 @@
]
},
"devDependencies": {
"@babel/eslint-parser": "^7.21.3",
"react-scripts": "5.0.1"
}
}
18 changes: 18 additions & 0 deletions code/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Technigo React App</title>

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@500&display=swap" rel="stylesheet">

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap" rel="stylesheet">

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" />
</head>

<body>
Expand Down
24 changes: 20 additions & 4 deletions code/src/App.js
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>
)
}
70 changes: 70 additions & 0 deletions code/src/components/AddTask.js
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;
Comment on lines +1 to +70

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!

23 changes: 23 additions & 0 deletions code/src/components/Footer.js
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;
43 changes: 43 additions & 0 deletions code/src/components/Header.js
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&apos;s
<span className="material-symbols-outlined">
rainy
</span> today.
</Weather>
</HeaderWrapper>
)
}

export default Header;
132 changes: 132 additions & 0 deletions code/src/components/TaskList.js
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

Choose a reason for hiding this comment

The 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;
Loading