├── .gitignore
├── .vscode
└── settings.json
├── README.md
├── package-lock.json
├── package.json
├── public
├── favicon.ico
├── index.html
├── logo192.png
├── logo512.png
├── manifest.json
└── robots.txt
├── src
├── App
│ ├── App.css
│ ├── AppUI.js
│ └── index.js
├── CreateTodoButton
│ ├── CreateTodoButton.css
│ └── index.js
├── EmptyTodos
│ └── index.js
├── Modal
│ ├── Modal.css
│ └── index.js
├── TodoContext
│ ├── index.js
│ └── useLocalStorage.js
├── TodoCounter
│ ├── TodoCounter.css
│ └── index.js
├── TodoForm
│ ├── TodoForm.css
│ └── index.js
├── TodoIcon
│ ├── CompleteIcon.js
│ ├── DeleteIcon.js
│ ├── TodoIcon.css
│ ├── check.svg
│ ├── delete.svg
│ └── index.js
├── TodoItem
│ ├── TodoItem.css
│ └── index.js
├── TodoList
│ ├── TodoList.css
│ └── index.js
├── TodoSearch
│ ├── TodoSearch.css
│ └── index.js
├── TodosError
│ └── index.js
├── TodosLoading
│ ├── TodosLoading.css
│ └── index.js
├── index.css
└── index.js
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "workbench.colorCustomizations": {
3 | "activityBar.activeBackground": "#1accff",
4 | "activityBar.activeBorder": "#df00ad",
5 | "activityBar.background": "#1accff",
6 | "activityBar.foreground": "#15202b",
7 | "activityBar.inactiveForeground": "#15202b99",
8 | "activityBarBadge.background": "#df00ad",
9 | "activityBarBadge.foreground": "#e7e7e7",
10 | "editorGroup.border": "#1accff",
11 | "panel.border": "#1accff",
12 | "sideBar.border": "#1accff",
13 | "statusBar.background": "#00b3e6",
14 | "statusBar.foreground": "#15202b",
15 | "statusBarItem.hoverBackground": "#008bb3",
16 | "tab.activeBorder": "#1accff",
17 | "titleBar.activeBackground": "#00b3e6",
18 | "titleBar.activeForeground": "#15202b",
19 | "titleBar.inactiveBackground": "#00b3e699",
20 | "titleBar.inactiveForeground": "#15202b99"
21 | },
22 | "peacock.color": "#00b3e6"
23 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Create React App
2 |
3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 |
5 | ## Available Scripts
6 |
7 | In the project directory, you can run:
8 |
9 | ### `yarn start`
10 |
11 | Runs the app in the development mode.\
12 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13 |
14 | The page will reload if you make edits.\
15 | You will also see any lint errors in the console.
16 |
17 | ### `yarn test`
18 |
19 | Launches the test runner in the interactive watch mode.\
20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21 |
22 | ### `yarn build`
23 |
24 | Builds the app for production to the `build` folder.\
25 | It correctly bundles React in production mode and optimizes the build for the best performance.
26 |
27 | The build is minified and the filenames include the hashes.\
28 | Your app is ready to be deployed!
29 |
30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31 |
32 | ### `yarn eject`
33 |
34 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35 |
36 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37 |
38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39 |
40 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41 |
42 | ## Learn More
43 |
44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45 |
46 | To learn React, check out the [React documentation](https://reactjs.org/).
47 |
48 | ### Code Splitting
49 |
50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51 |
52 | ### Analyzing the Bundle Size
53 |
54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55 |
56 | ### Making a Progressive Web App
57 |
58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59 |
60 | ### Advanced Configuration
61 |
62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63 |
64 | ### Deployment
65 |
66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67 |
68 | ### `yarn build` fails to minify
69 |
70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
71 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "curso-intro-react",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.11.4",
7 | "@testing-library/react": "^11.1.0",
8 | "@testing-library/user-event": "^12.1.10",
9 | "react": "^17.0.2",
10 | "react-dom": "^17.0.2",
11 | "react-scripts": "4.0.3",
12 | "web-vitals": "^1.0.1"
13 | },
14 | "scripts": {
15 | "start": "react-scripts start",
16 | "build": "react-scripts build",
17 | "test": "react-scripts test",
18 | "eject": "react-scripts eject",
19 | "predeploy": "npm run build",
20 | "deploy": "gh-pages -d build"
21 | },
22 | "eslintConfig": {
23 | "extends": [
24 | "react-app",
25 | "react-app/jest"
26 | ]
27 | },
28 | "browserslist": {
29 | "production": [
30 | ">0.2%",
31 | "not dead",
32 | "not op_mini all"
33 | ],
34 | "development": [
35 | "last 1 chrome version",
36 | "last 1 firefox version",
37 | "last 1 safari version"
38 | ]
39 | },
40 | "devDependencies": {
41 | "gh-pages": "^3.2.3"
42 | },
43 | "homepage": "https://platzi.github.io/curso-intro-react"
44 | }
45 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/platzi/curso-intro-react/a66d4708085e522cf98f377a28d5593d12ff83be/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 | React App
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/platzi/curso-intro-react/a66d4708085e522cf98f377a28d5593d12ff83be/public/logo192.png
--------------------------------------------------------------------------------
/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/platzi/curso-intro-react/a66d4708085e522cf98f377a28d5593d12ff83be/public/logo512.png
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/src/App/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-spin infinite 20s linear;
13 | }
14 | }
15 |
16 | .App-header {
17 | background-color: #282c34;
18 | min-height: 100vh;
19 | display: flex;
20 | flex-direction: column;
21 | align-items: center;
22 | justify-content: center;
23 | font-size: calc(10px + 2vmin);
24 | color: white;
25 | }
26 |
27 | .App-link {
28 | color: #61dafb;
29 | }
30 |
31 | @keyframes App-logo-spin {
32 | from {
33 | transform: rotate(0deg);
34 | }
35 | to {
36 | transform: rotate(360deg);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/App/AppUI.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { TodoContext } from '../TodoContext';
3 | import { TodoCounter } from '../TodoCounter';
4 | import { TodoSearch } from '../TodoSearch';
5 | import { TodoList } from '../TodoList';
6 | import { TodoItem } from '../TodoItem';
7 | import { TodosError } from '../TodosError';
8 | import { TodosLoading } from '../TodosLoading';
9 | import { EmptyTodos } from '../EmptyTodos';
10 | import { TodoForm } from '../TodoForm';
11 | import { CreateTodoButton } from '../CreateTodoButton';
12 | import { Modal } from '../Modal';
13 |
14 | function AppUI() {
15 | const {
16 | error,
17 | loading,
18 | searchedTodos,
19 | completeTodo,
20 | deleteTodo,
21 | openModal,
22 | setOpenModal,
23 | } = React.useContext(TodoContext);
24 |
25 | return (
26 |
27 |
28 |
29 |
30 |
31 | {error && }
32 | {loading && }
33 | {(!loading && !searchedTodos.length) && }
34 |
35 | {searchedTodos.map(todo => (
36 | completeTodo(todo.text)}
41 | onDelete={() => deleteTodo(todo.text)}
42 | />
43 | ))}
44 |
45 |
46 | {!!openModal && (
47 |
48 |
49 |
50 | )}
51 |
52 |
55 |
56 | );
57 | }
58 |
59 | export { AppUI };
60 |
--------------------------------------------------------------------------------
/src/App/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { TodoProvider } from '../TodoContext';
3 | import { AppUI } from './AppUI';
4 |
5 |
6 | function App() {
7 | return (
8 |
9 |
10 |
11 | );
12 | }
13 |
14 | export default App;
15 |
--------------------------------------------------------------------------------
/src/CreateTodoButton/CreateTodoButton.css:
--------------------------------------------------------------------------------
1 | .CreateTodoButton {
2 | background-color: #61DAFA;
3 | box-shadow: 0px 5px 25px rgba(97, 218, 250, 0.5);
4 | border: none;
5 | border-radius: 50%;
6 | cursor: pointer;
7 | font-size: 50px;
8 | position: fixed;
9 | bottom: 24px;
10 | right: 24px;
11 | font-weight: bold;
12 | color: #FAFAFA;
13 | display: flex;
14 | justify-content: center;
15 | align-items: center;
16 | height: 64px;
17 | width: 64px;
18 |
19 | transform: rotate(0);
20 | transition: .3s ease;
21 | z-index: 1;
22 | }
23 |
24 | .CreateTodoButton:hover {
25 | transform: rotate(224deg);
26 | }
27 |
--------------------------------------------------------------------------------
/src/CreateTodoButton/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './CreateTodoButton.css';
3 |
4 | function CreateTodoButton(props) {
5 | const onClickButton = () => {
6 | props.setOpenModal(prevState => !prevState);
7 | };
8 |
9 | return (
10 |
16 | );
17 | }
18 |
19 | export { CreateTodoButton };
20 |
--------------------------------------------------------------------------------
/src/EmptyTodos/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | function EmptyTodos() {
4 | return ¡Crea tu primer TODO!
;
5 | }
6 |
7 | export { EmptyTodos };
8 |
--------------------------------------------------------------------------------
/src/Modal/Modal.css:
--------------------------------------------------------------------------------
1 | .ModalBackground {
2 | background: rgba(32,35,41,.8);
3 | position: fixed;
4 | top: -10px;
5 | left: -10px;
6 | right: -10px;
7 | bottom: -10px;
8 | display: flex;
9 | justify-content: center;
10 | align-items: center;
11 | color: white;
12 | }
13 |
--------------------------------------------------------------------------------
/src/Modal/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './Modal.css';
4 |
5 | function Modal({ children }) {
6 | return ReactDOM.createPortal(
7 |
8 | {children}
9 |
,
10 | document.getElementById('modal')
11 | );
12 | }
13 |
14 | export { Modal };
15 |
--------------------------------------------------------------------------------
/src/TodoContext/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { useLocalStorage } from './useLocalStorage';
3 |
4 | const TodoContext = React.createContext();
5 |
6 | function TodoProvider(props) {
7 | const {
8 | item: todos,
9 | saveItem: saveTodos,
10 | loading,
11 | error,
12 | } = useLocalStorage('TODOS_V1', []);
13 | const [searchValue, setSearchValue] = React.useState('');
14 | const [openModal, setOpenModal] = React.useState(false);
15 |
16 | const completedTodos = todos.filter(todo => !!todo.completed).length;
17 | const totalTodos = todos.length;
18 |
19 | let searchedTodos = [];
20 |
21 | if (!searchValue.length >= 1) {
22 | searchedTodos = todos;
23 | } else {
24 | searchedTodos = todos.filter(todo => {
25 | const todoText = todo.text.toLowerCase();
26 | const searchText = searchValue.toLowerCase();
27 | return todoText.includes(searchText);
28 | });
29 | }
30 |
31 | const addTodo = (text) => {
32 | const newTodos = [...todos];
33 | newTodos.push({
34 | completed: false,
35 | text,
36 | });
37 | saveTodos(newTodos);
38 | };
39 |
40 | const completeTodo = (text) => {
41 | const todoIndex = todos.findIndex(todo => todo.text === text);
42 | const newTodos = [...todos];
43 | newTodos[todoIndex].completed = true;
44 | saveTodos(newTodos);
45 | };
46 |
47 | const deleteTodo = (text) => {
48 | const todoIndex = todos.findIndex(todo => todo.text === text);
49 | const newTodos = [...todos];
50 | newTodos.splice(todoIndex, 1);
51 | saveTodos(newTodos);
52 | };
53 |
54 | return (
55 |
69 | {props.children}
70 |
71 | );
72 | }
73 |
74 | export { TodoContext, TodoProvider };
75 |
--------------------------------------------------------------------------------
/src/TodoContext/useLocalStorage.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | function useLocalStorage(itemName, initialValue) {
4 | const [error, setError] = React.useState(false);
5 | const [loading, setLoading] = React.useState(true);
6 | const [item, setItem] = React.useState(initialValue);
7 |
8 | React.useEffect(() => {
9 | setTimeout(() => {
10 | try {
11 | const localStorageItem = localStorage.getItem(itemName);
12 | let parsedItem;
13 |
14 | if (!localStorageItem) {
15 | localStorage.setItem(itemName, JSON.stringify(initialValue));
16 | parsedItem = initialValue;
17 | } else {
18 | parsedItem = JSON.parse(localStorageItem);
19 | }
20 |
21 | setItem(parsedItem);
22 | setLoading(false);
23 | } catch(error) {
24 | setError(error);
25 | }
26 | }, 3000);
27 | });
28 |
29 | const saveItem = (newItem) => {
30 | try {
31 | const stringifiedItem = JSON.stringify(newItem);
32 | localStorage.setItem(itemName, stringifiedItem);
33 | setItem(newItem);
34 | } catch(error) {
35 | setError(error);
36 | }
37 | };
38 |
39 | return {
40 | item,
41 | saveItem,
42 | loading,
43 | error,
44 | };
45 | }
46 |
47 | export { useLocalStorage };
48 |
--------------------------------------------------------------------------------
/src/TodoCounter/TodoCounter.css:
--------------------------------------------------------------------------------
1 | .TodoCounter {
2 | font-size: 24px;
3 | text-align: center;
4 | margin: 0;
5 | padding: 48px;
6 | }
7 |
--------------------------------------------------------------------------------
/src/TodoCounter/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { TodoContext } from '../TodoContext';
3 | import './TodoCounter.css';
4 |
5 | function TodoCounter() {
6 | const { totalTodos, completedTodos } = React.useContext(TodoContext);
7 |
8 | return (
9 | Has completado {completedTodos} de {totalTodos} TODOs
10 | );
11 | }
12 |
13 | export { TodoCounter };
14 |
--------------------------------------------------------------------------------
/src/TodoForm/TodoForm.css:
--------------------------------------------------------------------------------
1 | form {
2 | width: 90%;
3 | max-width: 300px;
4 | background-color: #fff;
5 | padding: 33px 40px;
6 | display: flex;
7 | justify-content: center;
8 | align-items: center;
9 | flex-direction: column;
10 | }
11 |
12 | label {
13 | text-align: center;
14 | font-weight: bold;
15 | font-size: 20px;
16 | color: #1E1E1F;
17 | margin-bottom: 26px;
18 | }
19 |
20 | textarea {
21 | background-color: #F9FBFC;
22 | border: 2px solid #202329;
23 | border-radius: 2px;
24 | box-shadow: 0px 5px 50px rgba(32, 35, 41, 0.25);
25 | color: #1E1E1F;
26 | font-size: 20px;
27 | text-align: center;
28 | padding: 12px;
29 | height: 96px;
30 | width: calc(100% - 25px);
31 | }
32 |
33 | textarea::placeholder {
34 | color: #A5A5A5;
35 | font-family: 'Montserrat';
36 | font-weight: 400;
37 | }
38 |
39 | textarea:focus {
40 | outline-color: #61DAFA;
41 | }
42 |
43 | .TodoForm-buttonContainer {
44 | margin-top: 14px;
45 | display: flex;
46 | justify-content: space-between;
47 | align-items: center;
48 | width: 100%;
49 | }
50 |
51 | .TodoForm-button {
52 | cursor: pointer;
53 | display: inline-block;
54 | font-size: 20px;
55 | color: #202329;
56 | font-weight: 400;
57 | width: 120px;
58 | height: 48px;
59 | border-radius: 2px;
60 | border: none;
61 | font-family: 'Montserrat';
62 | }
63 |
64 | .TodoForm-button--add {
65 | background: #61DAFA;
66 | box-shadow: 0px 5px 25px rgba(97, 218, 250, 0.5);
67 | }
68 |
69 | .TodoForm-button--cancel {
70 | background: transparent;
71 | }
72 |
--------------------------------------------------------------------------------
/src/TodoForm/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { TodoContext } from '../TodoContext';
3 | import './TodoForm.css';
4 |
5 | function TodoForm() {
6 | const [newTodoValue, setNewTodoValue] = React.useState('');
7 | const {
8 | addTodo,
9 | setOpenModal,
10 | } = React.useContext(TodoContext);
11 |
12 | const onChange = (event) => {
13 | setNewTodoValue(event.target.value);
14 | };
15 | const onCancel = () => {
16 | setOpenModal(false);
17 | };
18 | const onSubmit = (event) => {
19 | event.preventDefault();
20 | addTodo(newTodoValue);
21 | setOpenModal(false);
22 | };
23 |
24 | return (
25 |
48 | );
49 | }
50 |
51 | export { TodoForm };
52 |
--------------------------------------------------------------------------------
/src/TodoIcon/CompleteIcon.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { TodoIcon } from './';
3 |
4 | function CompleteIcon({ completed, onComplete }) {
5 | return (
6 |
11 | );
12 | }
13 |
14 | export { CompleteIcon };
15 |
--------------------------------------------------------------------------------
/src/TodoIcon/DeleteIcon.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { TodoIcon } from './';
3 |
4 | function DeleteIcon({ onDelete }) {
5 | return (
6 |
10 | );
11 | }
12 |
13 | export { DeleteIcon };
14 |
--------------------------------------------------------------------------------
/src/TodoIcon/TodoIcon.css:
--------------------------------------------------------------------------------
1 | .Icon-container {
2 | cursor: pointer;
3 | display: flex;
4 | justify-content: center;
5 | align-items: center;
6 | height: 48px;
7 | width: 48px;
8 | /* background-color: #CCC; */
9 | }
10 | .Icon-container--check {
11 | position: absolute;
12 | left: 12px;
13 | }
14 | .Icon-container--delete {
15 | position: absolute;
16 | top: -24px;
17 | right: 0;
18 | }
19 |
20 | .Icon-svg {
21 | width: 24px;
22 | height: 24px;
23 | transition: fill .15s;
24 | }
25 | .Icon-container:hover .Icon-svg--check {
26 | fill: #4caf50;
27 | }
28 | .Icon-container:hover .Icon-svg--delete {
29 | fill: red;
30 | }
31 |
--------------------------------------------------------------------------------
/src/TodoIcon/check.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/src/TodoIcon/delete.svg:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/src/TodoIcon/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { ReactComponent as CheckSVG } from './check.svg';
3 | import { ReactComponent as DeleteSVG } from './delete.svg';
4 | import './TodoIcon.css';
5 |
6 | const iconTypes = {
7 | "check": color => (
8 |
9 | ),
10 | "delete": color => (
11 |
12 | ),
13 | };
14 |
15 | function TodoIcon({ type, color = 'gray', onClick }) {
16 | return (
17 |
21 | {iconTypes[type](color)}
22 |
23 | );
24 | }
25 |
26 | export { TodoIcon };
27 |
--------------------------------------------------------------------------------
/src/TodoItem/TodoItem.css:
--------------------------------------------------------------------------------
1 | .TodoItem {
2 | background-color: #FAFAFA;
3 | position: relative;
4 | display: flex;
5 | justify-content: center;
6 | align-items: center;
7 | margin-top: 24px;
8 | box-shadow: 0px 5px 50px rgba(32, 35, 41, 0.15);
9 | }
10 |
11 | .TodoItem-p {
12 | color: #1E1E1F;
13 | margin: 24px 0 24px 24px;
14 | width: calc(100% - 120px);
15 | font-size: 18px;
16 | line-height: 24px;
17 | font-weight: 400;
18 | }
19 | .TodoItem-p--complete {
20 | text-decoration: line-through;
21 | }
22 |
--------------------------------------------------------------------------------
/src/TodoItem/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { CompleteIcon } from '../TodoIcon/CompleteIcon';
3 | import { DeleteIcon } from '../TodoIcon/DeleteIcon';
4 | import './TodoItem.css';
5 |
6 | function TodoItem(props) {
7 | return (
8 |
9 |
13 |
16 | {props.text}
17 |
18 |
21 |
22 | );
23 | }
24 |
25 | export { TodoItem };
26 |
--------------------------------------------------------------------------------
/src/TodoList/TodoList.css:
--------------------------------------------------------------------------------
1 | ul {
2 | margin: 0;
3 | padding: 0 0 56px 0;
4 | list-style: none;
5 | }
6 |
--------------------------------------------------------------------------------
/src/TodoList/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './TodoList.css'
3 |
4 | function TodoList(props) {
5 | return (
6 |
11 | );
12 | }
13 |
14 | export { TodoList };
15 |
--------------------------------------------------------------------------------
/src/TodoSearch/TodoSearch.css:
--------------------------------------------------------------------------------
1 | .TodoSearch {
2 | background: #F9FBFC;
3 | border-radius: 2px;
4 | border: 2px solid #202329;
5 | margin: 0 24px;
6 | height: 64px;
7 | width: calc(100% - 62px);
8 | font-size: 24px;
9 | text-align: center;
10 | font-family: 'Montserrat';
11 | font-weight: 400;
12 | color: #1E1E1F;
13 | box-shadow: 0px 5px 50px rgba(32, 35, 41, 0.25);
14 | }
15 |
16 | .TodoSearch::placeholder {
17 | color: #A5A5A5;
18 | font-family: 'Montserrat';
19 | font-weight: 400;
20 | }
21 |
22 | .TodoSearch:focus {
23 | outline-color: #61DAFA;
24 | }
25 |
--------------------------------------------------------------------------------
/src/TodoSearch/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { TodoContext } from '../TodoContext';
3 | import './TodoSearch.css';
4 |
5 | function TodoSearch() {
6 | const { searchValue, setSearchValue } = React.useContext(TodoContext);
7 |
8 | const onSearchValueChange = (event) => {
9 | console.log(event.target.value);
10 | setSearchValue(event.target.value);
11 | };
12 |
13 | return (
14 |
20 | );
21 | }
22 |
23 | export { TodoSearch };
24 |
--------------------------------------------------------------------------------
/src/TodosError/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | function TodosError() {
4 | return Desespérate, hubo un error...
;
5 | }
6 |
7 | export { TodosError };
8 |
--------------------------------------------------------------------------------
/src/TodosLoading/TodosLoading.css:
--------------------------------------------------------------------------------
1 | .LoadingTodo-container {
2 | position: relative;
3 | display: flex;
4 | justify-content: center;
5 | align-items: center;
6 | margin-top: 24px;
7 | box-shadow: 0px 5px 50px rgba(32, 35, 41, 0.15);
8 | }
9 |
10 | .LoadingTodo-text {
11 | margin: 24px 0 24px 24px;
12 | width: calc(100% - 120px);
13 | font-size: 18px;
14 | line-height: 24px;
15 | font-weight: 400;
16 | }
17 |
18 | .LoadingTodo-completeIcon,
19 | .LoadingTodo-deleteIcon {
20 | border-radius: 50px;
21 | height: 48px;
22 | width: 48px;
23 | }
24 |
25 | .LoadingTodo-completeIcon {
26 | position: absolute;
27 | left: 12px;
28 | }
29 |
30 | .LoadingTodo-deleteIcon {
31 | position: absolute;
32 | top: -24px;
33 | right: 0;
34 | }
35 |
36 | .LoadingTodo-container,
37 | .LoadingTodo-completeIcon,
38 | .LoadingTodo-deleteIcon {
39 | background: linear-gradient(90deg, rgba(250,250,250,1), rgb(200, 199, 199));
40 | background-size: 400% 400%;
41 | animation: loadingAnimation 3s ease-in-out infinite;
42 | }
43 |
44 | @keyframes loadingAnimation {
45 | 0% {
46 | background-position: 0% 50%;
47 | }
48 | 50% {
49 | background-position: 100% 50%;
50 | }
51 | 100% {
52 | background-position: 0% 50%;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/TodosLoading/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './TodosLoading.css';
3 |
4 | function TodosLoading() {
5 | return (
6 |
7 |
8 |
Cargando TODOs...
9 |
10 |
11 | );
12 | }
13 |
14 | export { TodosLoading };
15 |
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | background: #F2F4F5;
5 | color: #1E1E1F;
6 | font-family: 'Montserrat', Arial, Helvetica, sans-serif;
7 | }
8 |
9 | #root {
10 | margin: 0 24px;
11 | position: relative;
12 | min-height: 100vh;
13 | }
14 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App/index.js';
4 | import './index.css';
5 |
6 | ReactDOM.render(
7 | ,
8 | document.getElementById('root')
9 | );
10 |
--------------------------------------------------------------------------------