-
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
Styling - adding favicon #452
Open
malvinamaria
wants to merge
5
commits into
Technigo:master
Choose a base branch
from
malvinamaria:styling
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
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a6c4809
setting up the store and start using hooks in Redux
malvinamaria 2d848d2
add toggle logic and fix remove item button
malvinamaria d4d2836
complete styling and functionality
malvinamaria 26bccf7
add favicon
malvinamaria 32df03e
fix index file
malvinamaria 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
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
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"short_name": "ToDO", | ||
"name": "ToDo", | ||
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. Wow! Whats happening here? |
||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
}, | ||
{ | ||
"src": "logo192.png", | ||
"type": "image/png", | ||
"sizes": "192x192" | ||
}, | ||
{ | ||
"src": "logo512.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
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,26 @@ | ||
/* eslint-disable comma-dangle */ | ||
import { ToDoList } from 'components/ToDoList'; | ||
import React from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import { combineReducers, configureStore } from '@reduxjs/toolkit'; | ||
import { tasks } from 'reducers/tasks'; | ||
import { Header } from 'components/Header'; | ||
import { AddNewTask } from 'components/AddNewTask'; | ||
|
||
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}> | ||
<div className="layout"> | ||
<Header /> | ||
<AddNewTask /> | ||
<ToDoList /> | ||
</div> | ||
</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,32 @@ | ||
.add-task-btn img { | ||
width: 1.5rem; | ||
height: 1.5rem; | ||
margin-left: 1rem; | ||
} | ||
.add-task-btn { | ||
display: flex; | ||
align-items: center; | ||
font-size: 1rem; | ||
color: rgb(48, 45, 43); | ||
font-family: 'Sora', sans-serif; | ||
padding: 10px; | ||
} | ||
|
||
.form-container { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
font-family: 'Sora', sans-serif; | ||
width: 400px; | ||
margin: auto; | ||
margin-top: 20px; | ||
margin-bottom: 20px; | ||
padding: 20px; | ||
font-size: 16px; | ||
box-shadow: 10px 5px rgb(245, 244, 242); | ||
border: 1px solid; | ||
background-color: rgb(187, 173, 255); | ||
color: rgb(48, 45, 43); | ||
font-family: 'Sora', sans-serif; | ||
border-radius: 55px; | ||
} |
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,78 @@ | ||
/* eslint-disable comma-dangle */ | ||
/* eslint-disable react/jsx-closing-bracket-location */ | ||
import React from 'react'; | ||
import { useDispatch } from 'react-redux'; | ||
import { tasks } from 'reducers/tasks'; | ||
import './AddNewTask.css'; | ||
import swal from 'sweetalert'; | ||
import plus from '../img/plus.png'; | ||
|
||
function getOrdinalSuffix(day) { | ||
if (day >= 11 && day <= 13) { | ||
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. Whats happening here? Make a comment to this maybe? |
||
return 'th'; | ||
} | ||
switch (day % 10) { | ||
case 1: | ||
return 'st'; | ||
case 2: | ||
return 'nd'; | ||
case 3: | ||
return 'rd'; | ||
default: | ||
return 'th'; | ||
} | ||
} | ||
// Create a functional component named 'AddNewTask' | ||
export const AddNewTask = () => { | ||
const date = new Date(); | ||
const month = date.toLocaleString('default', { month: 'long' }); | ||
const day = date.getDate(); | ||
const ordinal = getOrdinalSuffix(day); | ||
const year = date.getFullYear(); | ||
// Use the useDispatch hook to get access to the Redux dispatch function | ||
const dispatch = useDispatch(); | ||
// Use the useState hook to declare a new state variable 'newTaskValue' | ||
const [newTaskValue, setNewTaskValue] = React.useState(''); | ||
|
||
// Define a function to handle the form submission | ||
const onFormSubmit = (event) => { | ||
// Prevent the default form submission behavior | ||
event.preventDefault(); | ||
// Check if the new task input field is empty | ||
if (newTaskValue === '') { | ||
// If it is, show an alert to the user | ||
swal({ | ||
title: 'Please enter a task', | ||
text: 'You need to enter a task to add it to your list', | ||
icon: 'warning', | ||
}); | ||
return; | ||
} | ||
|
||
// Dispatch an action to add the new task to the store | ||
dispatch(tasks.actions.addTask(newTaskValue)); | ||
// Reset the value of the new task input field | ||
setNewTaskValue(''); | ||
}; | ||
// Render a section with a class name of 'add-new-task' | ||
return ( | ||
<form className="form-container" onSubmit={onFormSubmit}> | ||
<h3>What do you need to do today?</h3> | ||
<h4>{`${month} ${day}${ordinal}, ${year}`}</h4>{' '} | ||
<label htmlFor="addTaskInput"> | ||
<input | ||
className="add-task-input" | ||
type="text" | ||
value={newTaskValue} | ||
onChange={(event) => setNewTaskValue(event.target.value)} | ||
id="addTaskInput" | ||
placeholder="Add new task here" | ||
/> | ||
</label> | ||
<button className="add-task-btn" type="submit"> | ||
Task | ||
<img src={plus} alt="plus" /> | ||
</button> | ||
</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,75 @@ | ||
/* .header { | ||
background-color: rgb(54, 50, 64); | ||
min-height: 25vh; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: calc(10px + 2vmin); | ||
color: white; | ||
font-family: 'Sora', sans-serif; | ||
} */ | ||
.header { | ||
background-color: rgb(54, 50, 64); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
font-family: 'Sora', sans-serif; | ||
width: 400px; | ||
margin: auto; | ||
margin-top: 20px; | ||
margin-bottom: 20px; | ||
padding: 20px; | ||
font-size: 16px; | ||
box-shadow: 10px 5px rgb(245, 244, 242); | ||
border: 1px solid; | ||
background-color: rgb(187, 173, 255); | ||
color: rgb(48, 45, 43); | ||
border-radius: 55px; | ||
} | ||
.clear-all-button { | ||
display: flex; | ||
background: none; | ||
border: none; | ||
cursor: pointer; | ||
font-family: 'Sora', sans-serif; | ||
color: rgb(48, 45, 43); | ||
font-size: 1rem; | ||
margin-left: 1rem; | ||
margin-bottom: 1rem; | ||
align-items: center; | ||
} | ||
|
||
.clear-all-button img { | ||
width: 1.5rem; | ||
height: 1.5rem; | ||
margin-left: 1rem; | ||
text-align: center; | ||
} | ||
.clear-all { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
font-family: 'Sora', sans-serif; | ||
} | ||
h4 { | ||
margin: 5px; | ||
padding: 10px; | ||
} | ||
h1 { | ||
margin: 5px; | ||
} | ||
input { | ||
background-color: #fff; | ||
border-radius: 20px; | ||
border: none; | ||
color: black; | ||
cursor: pointer; | ||
padding: 10px 20px; | ||
box-shadow: fff; | ||
} | ||
.header-container { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} |
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,42 @@ | ||
/* eslint-disable react/jsx-closing-bracket-location */ | ||
import React from 'react'; | ||
import { tasks } from 'reducers/tasks'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import './Header.css'; | ||
import remove from '../img/remove.png'; | ||
|
||
export const Header = () => { | ||
const dispatch = useDispatch(); | ||
const numberOfTasks = useSelector((store) => store.tasks.length); | ||
// const completedTasks = tasks.filter((task) => task.isComplete); | ||
|
||
// const allDone = () => { | ||
// if (tasks.length === completedTasks.length) { | ||
// return 'You are all done!'; | ||
// } | ||
// return `${completedTasks.length} out of ${tasks.length} tasks completed`; | ||
// }; | ||
|
||
return ( | ||
<div className="header"> | ||
<div className="header-only"> | ||
<header> | ||
<div className="header-container"> | ||
<h1>My To Do List ✅ </h1> | ||
<h4># {numberOfTasks} remaining todos</h4> | ||
<div className="clear-all"> | ||
<button | ||
className="clear-all-button" | ||
type="button" | ||
onClick={() => dispatch(tasks.actions.clearAll())} | ||
> | ||
Clear all <img src={remove} alt="remove" /> | ||
</button> | ||
</div> | ||
</div> | ||
<div className="all-done">{/* <h4>{allDone()}</h4> */}</div> | ||
</header> | ||
</div> | ||
</div> | ||
); | ||
}; |
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.
Nice with the favicon!