├── calculator ├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── components │ ├── Calculator.css │ └── Calculator.jsx │ ├── index.css │ ├── index.js │ ├── logo.svg │ ├── reportWebVitals.js │ └── setupTests.js ├── pokedex ├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public │ ├── assets │ │ └── pokemon-logo.png │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ ├── pokeball.ico │ └── robots.txt └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── components │ ├── Navbar │ │ └── index.jsx │ ├── PokemonCard │ │ └── index.jsx │ ├── PokemonTable │ │ └── index.jsx │ └── Skeletons │ │ └── index.jsx │ ├── index.css │ ├── index.js │ ├── logo.svg │ ├── pages │ ├── Home.jsx │ └── Profile.jsx │ ├── reportWebVitals.js │ ├── router │ └── index.jsx │ ├── setupTests.js │ └── utils │ └── index.js └── todo-list ├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt └── src ├── App.css ├── App.js ├── App.test.js ├── components ├── EditTodoDialog.jsx ├── Form.jsx └── TodoItem.jsx ├── index.css ├── index.js ├── logo.svg ├── pages └── Home.jsx ├── reportWebVitals.js └── setupTests.js /calculator/.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 | -------------------------------------------------------------------------------- /calculator/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 | ### `npm 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 | ### `npm 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 | ### `npm run 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 | ### `npm run 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 | ### `npm run 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 | -------------------------------------------------------------------------------- /calculator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "calculator", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@emotion/react": "^11.5.0", 7 | "@emotion/styled": "^11.3.0", 8 | "@mui/material": "^5.0.4", 9 | "@testing-library/jest-dom": "^5.14.1", 10 | "@testing-library/react": "^11.2.7", 11 | "@testing-library/user-event": "^12.8.3", 12 | "emotion": "^11.0.0", 13 | "react": "^17.0.2", 14 | "react-dom": "^17.0.2", 15 | "react-scripts": "4.0.3", 16 | "web-vitals": "^1.1.2" 17 | }, 18 | "scripts": { 19 | "start": "react-scripts start", 20 | "build": "react-scripts build", 21 | "test": "react-scripts test", 22 | "eject": "react-scripts eject" 23 | }, 24 | "eslintConfig": { 25 | "extends": [ 26 | "react-app", 27 | "react-app/jest" 28 | ] 29 | }, 30 | "browserslist": { 31 | "production": [ 32 | ">0.2%", 33 | "not dead", 34 | "not op_mini all" 35 | ], 36 | "development": [ 37 | "last 1 chrome version", 38 | "last 1 firefox version", 39 | "last 1 safari version" 40 | ] 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /calculator/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentbyleo/react-projects/3d54c1a41161a97f081926287c903116a9cf0a0d/calculator/public/favicon.ico -------------------------------------------------------------------------------- /calculator/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /calculator/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentbyleo/react-projects/3d54c1a41161a97f081926287c903116a9cf0a0d/calculator/public/logo192.png -------------------------------------------------------------------------------- /calculator/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentbyleo/react-projects/3d54c1a41161a97f081926287c903116a9cf0a0d/calculator/public/logo512.png -------------------------------------------------------------------------------- /calculator/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 | -------------------------------------------------------------------------------- /calculator/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /calculator/src/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 | -------------------------------------------------------------------------------- /calculator/src/App.js: -------------------------------------------------------------------------------- 1 | import logo from './logo.svg'; 2 | import './App.css'; 3 | import Calculator from './components/Calculator'; 4 | 5 | function App() { 6 | return ( 7 |
8 | 9 |
10 | ); 11 | } 12 | 13 | export default App; 14 | -------------------------------------------------------------------------------- /calculator/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /calculator/src/components/Calculator.css: -------------------------------------------------------------------------------- 1 | button{ 2 | width: 3em; 3 | height: 3em; 4 | font-size: 1.5em; 5 | border: none; 6 | border-radius: 2em; 7 | margin: 0.3em; 8 | } 9 | 10 | button:hover{ 11 | cursor: pointer; 12 | } 13 | 14 | .wrapper{ 15 | background-color: black; 16 | border-radius: 1em; 17 | padding: 1em; 18 | } 19 | 20 | .orange{ 21 | background-color: #FF9500; 22 | color: white; 23 | } 24 | 25 | .gray{ 26 | background-color: #505050; 27 | color: white; 28 | } 29 | .result{ 30 | color: white; 31 | display: flex; 32 | justify-content: flex-end; 33 | margin-right: 1em; 34 | font-size:3.5em; 35 | } -------------------------------------------------------------------------------- /calculator/src/components/Calculator.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import "./Calculator.css"; 3 | import Container from "@mui/material/Container"; 4 | import { Box } from "@mui/system"; 5 | 6 | export default function Calculator() { 7 | const [num, setNum] = useState(0); 8 | const [oldnum, setOldNum] = useState(0); 9 | const [operator, setOperator] = useState(); 10 | 11 | function inputNum(e) { 12 | var input = e.target.value; 13 | if (num === 0) { 14 | setNum(input); 15 | } else { 16 | setNum(num + input); 17 | } 18 | } 19 | 20 | function clear() { 21 | setNum(0); 22 | } 23 | 24 | function porcentage() { 25 | setNum(num / 100); 26 | } 27 | 28 | function changeSign() { 29 | if (num > 0) { 30 | setNum(-num); 31 | } else { 32 | setNum(Math.abs(num)); 33 | } 34 | } 35 | 36 | function operatorHandler(e) { 37 | var operatorInput = e.target.value; 38 | setOperator(operatorInput); 39 | setOldNum(num); 40 | setNum(0); 41 | } 42 | 43 | function calculate() { 44 | if (operator === "/") { 45 | setNum(parseFloat(oldnum) / parseFloat(num)); 46 | } else if (operator === "X") { 47 | setNum(parseFloat(oldnum) * parseFloat(num)); 48 | } else if (operator === "-") { 49 | console.log(oldnum) 50 | console.log(num) 51 | console.log(oldnum-num) 52 | setNum(parseFloat(oldnum) - parseFloat(num)); 53 | } else if (operator === "+") { 54 | setNum(parseFloat(oldnum) + parseFloat(num)); 55 | } 56 | } 57 | 58 | return ( 59 |
60 | 61 | 62 |
63 | 64 |

{num}

65 | 66 | 67 | 68 | 71 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | 95 | 98 | 101 | 104 | 107 | 110 | 113 | 116 | 119 |
120 |
121 |
122 | ); 123 | } 124 | -------------------------------------------------------------------------------- /calculator/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /calculator/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | document.getElementById('root') 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /calculator/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /calculator/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /calculator/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /pokedex/.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 | -------------------------------------------------------------------------------- /pokedex/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 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 13 | 14 | The page will reload when you make changes.\ 15 | You may also see any lint errors in the console. 16 | 17 | ### `npm 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 | ### `npm run 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 | ### `npm run 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 | ### `npm run 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 | -------------------------------------------------------------------------------- /pokedex/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pokedex", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@emotion/react": "^11.10.0", 7 | "@emotion/styled": "^11.10.0", 8 | "@mui/icons-material": "^5.8.4", 9 | "@mui/material": "^5.10.0", 10 | "@testing-library/jest-dom": "^5.16.5", 11 | "@testing-library/react": "^13.3.0", 12 | "@testing-library/user-event": "^13.5.0", 13 | "axios": "^0.27.2", 14 | "react": "^18.2.0", 15 | "react-dom": "^18.2.0", 16 | "react-router-dom": "^6.9.0", 17 | "react-scripts": "5.0.1", 18 | "web-vitals": "^2.1.4" 19 | }, 20 | "scripts": { 21 | "start": "react-scripts start", 22 | "build": "react-scripts build", 23 | "test": "react-scripts test", 24 | "eject": "react-scripts eject" 25 | }, 26 | "eslintConfig": { 27 | "extends": [ 28 | "react-app", 29 | "react-app/jest" 30 | ] 31 | }, 32 | "browserslist": { 33 | "production": [ 34 | ">0.2%", 35 | "not dead", 36 | "not op_mini all" 37 | ], 38 | "development": [ 39 | "last 1 chrome version", 40 | "last 1 firefox version", 41 | "last 1 safari version" 42 | ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pokedex/public/assets/pokemon-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentbyleo/react-projects/3d54c1a41161a97f081926287c903116a9cf0a0d/pokedex/public/assets/pokemon-logo.png -------------------------------------------------------------------------------- /pokedex/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentbyleo/react-projects/3d54c1a41161a97f081926287c903116a9cf0a0d/pokedex/public/favicon.ico -------------------------------------------------------------------------------- /pokedex/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | Pokédex 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /pokedex/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentbyleo/react-projects/3d54c1a41161a97f081926287c903116a9cf0a0d/pokedex/public/logo192.png -------------------------------------------------------------------------------- /pokedex/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentbyleo/react-projects/3d54c1a41161a97f081926287c903116a9cf0a0d/pokedex/public/logo512.png -------------------------------------------------------------------------------- /pokedex/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 | -------------------------------------------------------------------------------- /pokedex/public/pokeball.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentbyleo/react-projects/3d54c1a41161a97f081926287c903116a9cf0a0d/pokedex/public/pokeball.ico -------------------------------------------------------------------------------- /pokedex/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /pokedex/src/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 | -------------------------------------------------------------------------------- /pokedex/src/App.js: -------------------------------------------------------------------------------- 1 | import logo from "./logo.svg"; 2 | import "./App.css"; 3 | import { Home } from "./pages/Home"; 4 | import { Router } from "./router"; 5 | 6 | function App() { 7 | return ; 8 | } 9 | 10 | export default App; 11 | -------------------------------------------------------------------------------- /pokedex/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /pokedex/src/components/Navbar/index.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { styled, alpha } from "@mui/material/styles"; 3 | import AppBar from "@mui/material/AppBar"; 4 | import Box from "@mui/material/Box"; 5 | import Toolbar from "@mui/material/Toolbar"; 6 | import IconButton from "@mui/material/IconButton"; 7 | import Typography from "@mui/material/Typography"; 8 | import InputBase from "@mui/material/InputBase"; 9 | import MenuIcon from "@mui/icons-material/Menu"; 10 | import SearchIcon from "@mui/icons-material/Search"; 11 | import { useNavigate } from "react-router-dom"; 12 | 13 | const Search = styled("div")(({ theme }) => ({ 14 | position: "relative", 15 | borderRadius: theme.shape.borderRadius, 16 | backgroundColor: alpha(theme.palette.common.white, 0.15), 17 | "&:hover": { 18 | backgroundColor: alpha(theme.palette.common.white, 0.25), 19 | }, 20 | marginLeft: 0, 21 | width: "100%", 22 | [theme.breakpoints.up("sm")]: { 23 | marginLeft: theme.spacing(1), 24 | width: "auto", 25 | }, 26 | })); 27 | 28 | const SearchIconWrapper = styled("div")(({ theme }) => ({ 29 | padding: theme.spacing(0, 2), 30 | height: "100%", 31 | position: "absolute", 32 | pointerEvents: "none", 33 | display: "flex", 34 | alignItems: "center", 35 | justifyContent: "center", 36 | })); 37 | 38 | const StyledInputBase = styled(InputBase)(({ theme }) => ({ 39 | color: "inherit", 40 | "& .MuiInputBase-input": { 41 | padding: theme.spacing(1, 1, 1, 0), 42 | // vertical padding + font size from searchIcon 43 | paddingLeft: `calc(1em + ${theme.spacing(4)})`, 44 | transition: theme.transitions.create("width"), 45 | width: "100%", 46 | [theme.breakpoints.up("sm")]: { 47 | width: "12ch", 48 | "&:focus": { 49 | width: "20ch", 50 | }, 51 | }, 52 | }, 53 | })); 54 | 55 | export default function Navbar({ pokemonFilter, hideSearch }) { 56 | const navigate = useNavigate(); 57 | return ( 58 | 59 | 60 | 61 | 62 | navigate("/")} /> 63 | {!hideSearch && ( 64 | pokemonFilter(e.target.value)}> 65 | 66 | 67 | 68 | 69 | 70 | )} 71 | 72 | 73 | 74 | 75 | ); 76 | } 77 | -------------------------------------------------------------------------------- /pokedex/src/components/PokemonCard/index.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import Card from "@mui/material/Card"; 3 | import CardContent from "@mui/material/CardContent"; 4 | import CardMedia from "@mui/material/CardMedia"; 5 | import Typography from "@mui/material/Typography"; 6 | import { Box, CardActionArea } from "@mui/material"; 7 | import { typeHandler } from "../../utils"; 8 | 9 | export default function PokemonCard({ name, image, types }) { 10 | return ( 11 | 12 | 13 | 14 | 15 | 16 | 17 | {name} 18 | 19 | 20 | {typeHandler(types)} 21 | 22 | 23 | 24 | 25 | 26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /pokedex/src/components/PokemonTable/index.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import Table from "@mui/material/Table"; 3 | import TableBody from "@mui/material/TableBody"; 4 | import TableCell from "@mui/material/TableCell"; 5 | import TableContainer from "@mui/material/TableContainer"; 6 | import TableHead from "@mui/material/TableHead"; 7 | import TableRow from "@mui/material/TableRow"; 8 | import Paper from "@mui/material/Paper"; 9 | import { typeHandler } from "../../utils"; 10 | 11 | export default function PokemonTable({ pokemonData }) { 12 | const { height, weight, types } = pokemonData; 13 | 14 | return ( 15 | 16 | 17 | 18 | 19 | Height 20 | {height + "cm"} 21 | 22 | 23 | Weight 24 | {weight + "g"} 25 | 26 | 27 | Tipo 28 | {typeHandler(types)} 29 | 30 | 31 |
32 |
33 | ); 34 | } 35 | -------------------------------------------------------------------------------- /pokedex/src/components/Skeletons/index.jsx: -------------------------------------------------------------------------------- 1 | import { Skeleton } from "@mui/material"; 2 | import { Container } from "@mui/system"; 3 | import React from "react"; 4 | 5 | export const Skeletons = () => { 6 | return ( 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | ); 15 | }; 16 | -------------------------------------------------------------------------------- /pokedex/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /pokedex/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | const root = ReactDOM.createRoot(document.getElementById('root')); 8 | root.render( 9 | 10 | 11 | 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /pokedex/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pokedex/src/pages/Home.jsx: -------------------------------------------------------------------------------- 1 | import { Box, Grid } from "@mui/material"; 2 | import { Container } from "@mui/system"; 3 | import axios from "axios"; 4 | import React, { useEffect, useState } from "react"; 5 | import { useLocation, useNavigate } from "react-router-dom"; 6 | import Navbar from "../components/Navbar"; 7 | import PokemonCard from "../components/PokemonCard"; 8 | import { Skeletons } from "../components/Skeletons"; 9 | 10 | export const Home = ({ setPokemonData }) => { 11 | const [pokemons, setPokemons] = useState([]); 12 | const navigate = useNavigate(); 13 | 14 | useEffect(() => { 15 | getPokemons(); 16 | }, []); 17 | 18 | const getPokemons = () => { 19 | var endpoints = []; 20 | for (var i = 1; i < 200; i++) { 21 | endpoints.push(`https://pokeapi.co/api/v2/pokemon/${i}/`); 22 | } 23 | axios.all(endpoints.map((endpoint) => axios.get(endpoint))).then((res) => setPokemons(res)); 24 | }; 25 | 26 | const pokemonFilter = (name) => { 27 | var filteredPokemons = []; 28 | if (name === "") { 29 | getPokemons(); 30 | } 31 | for (var i in pokemons) { 32 | if (pokemons[i].data.name.includes(name)) { 33 | filteredPokemons.push(pokemons[i]); 34 | } 35 | } 36 | 37 | setPokemons(filteredPokemons); 38 | }; 39 | 40 | const pokemonPickHandler = (pokemonData) => { 41 | setPokemonData(pokemonData); 42 | navigate("/profile"); 43 | }; 44 | 45 | return ( 46 |
47 | 48 | 49 | 50 | {pokemons.length === 0 ? ( 51 | 52 | ) : ( 53 | pokemons.map((pokemon, key) => ( 54 | 55 | pokemonPickHandler(pokemon.data)}> 56 | 57 | 58 | 59 | )) 60 | )} 61 | 62 | 63 |
64 | ); 65 | }; 66 | -------------------------------------------------------------------------------- /pokedex/src/pages/Profile.jsx: -------------------------------------------------------------------------------- 1 | import { Chip, Container, Divider, Paper, Typography } from "@mui/material"; 2 | import { Box } from "@mui/system"; 3 | import React, { useEffect } from "react"; 4 | import { useNavigate } from "react-router-dom"; 5 | import Navbar from "../components/Navbar"; 6 | import PokemonTable from "../components/PokemonTable"; 7 | 8 | export const Profile = ({ pokemonData }) => { 9 | const { name, sprites, moves } = pokemonData || {}; 10 | const navigate = useNavigate(); 11 | 12 | useEffect(() => { 13 | if (!pokemonData) { 14 | navigate("/"); 15 | } 16 | }, []); 17 | 18 | if (!pokemonData) { 19 | return null; 20 | } 21 | 22 | return ( 23 | <> 24 | 25 | 26 | 27 | 28 | {name} 29 | 41 | 42 | 43 | 44 | 45 | Variações 46 | 47 | 48 | 49 | 50 | 51 | Ataques 52 | 53 | {moves.map((moveData, key) => ( 54 | 55 | ))} 56 | 57 | 58 | 59 | 60 | 61 | 62 | ); 63 | }; 64 | -------------------------------------------------------------------------------- /pokedex/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /pokedex/src/router/index.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { BrowserRouter, Route, Routes } from "react-router-dom"; 3 | import { Home } from "../pages/Home"; 4 | import { Profile } from "../pages/Profile"; 5 | 6 | export const Router = () => { 7 | const [pokemonData, setPokemonData] = useState(); 8 | 9 | return ( 10 | 11 | 12 | } /> 13 | } />; 14 | 15 | 16 | ); 17 | }; 18 | -------------------------------------------------------------------------------- /pokedex/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /pokedex/src/utils/index.js: -------------------------------------------------------------------------------- 1 | export const typeHandler = (types) => { 2 | if (types[1]) { 3 | return types[0].type.name + " | " + types[1].type.name; 4 | } 5 | return types[0].type.name; 6 | }; 7 | -------------------------------------------------------------------------------- /todo-list/.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 | -------------------------------------------------------------------------------- /todo-list/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 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 13 | 14 | The page will reload when you make changes.\ 15 | You may also see any lint errors in the console. 16 | 17 | ### `npm 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 | ### `npm run 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 | ### `npm run 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 | ### `npm run 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 | -------------------------------------------------------------------------------- /todo-list/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "todo-list", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@emotion/react": "^11.7.1", 7 | "@emotion/styled": "^11.6.0", 8 | "@mui/icons-material": "^5.2.5", 9 | "@mui/material": "^5.2.8", 10 | "@testing-library/jest-dom": "^5.16.1", 11 | "@testing-library/react": "^12.1.2", 12 | "@testing-library/user-event": "^13.5.0", 13 | "react": "^17.0.2", 14 | "react-dom": "^17.0.2", 15 | "react-scripts": "5.0.0", 16 | "web-vitals": "^2.1.3" 17 | }, 18 | "scripts": { 19 | "start": "react-scripts start", 20 | "build": "react-scripts build", 21 | "test": "react-scripts test", 22 | "eject": "react-scripts eject" 23 | }, 24 | "eslintConfig": { 25 | "extends": [ 26 | "react-app", 27 | "react-app/jest" 28 | ] 29 | }, 30 | "browserslist": { 31 | "production": [ 32 | ">0.2%", 33 | "not dead", 34 | "not op_mini all" 35 | ], 36 | "development": [ 37 | "last 1 chrome version", 38 | "last 1 firefox version", 39 | "last 1 safari version" 40 | ] 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /todo-list/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentbyleo/react-projects/3d54c1a41161a97f081926287c903116a9cf0a0d/todo-list/public/favicon.ico -------------------------------------------------------------------------------- /todo-list/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /todo-list/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentbyleo/react-projects/3d54c1a41161a97f081926287c903116a9cf0a0d/todo-list/public/logo192.png -------------------------------------------------------------------------------- /todo-list/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/developmentbyleo/react-projects/3d54c1a41161a97f081926287c903116a9cf0a0d/todo-list/public/logo512.png -------------------------------------------------------------------------------- /todo-list/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 | -------------------------------------------------------------------------------- /todo-list/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /todo-list/src/App.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background-color: gainsboro; 3 | } -------------------------------------------------------------------------------- /todo-list/src/App.js: -------------------------------------------------------------------------------- 1 | import "./App.css"; 2 | import Home from "./pages/Home"; 3 | 4 | function App() { 5 | return ; 6 | } 7 | 8 | export default App; 9 | -------------------------------------------------------------------------------- /todo-list/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /todo-list/src/components/EditTodoDialog.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import Button from "@mui/material/Button"; 3 | import Dialog from "@mui/material/Dialog"; 4 | import DialogActions from "@mui/material/DialogActions"; 5 | import DialogContent from "@mui/material/DialogContent"; 6 | import DialogContentText from "@mui/material/DialogContentText"; 7 | import DialogTitle from "@mui/material/DialogTitle"; 8 | import Slide from "@mui/material/Slide"; 9 | import { TextField } from "@mui/material"; 10 | 11 | const Transition = React.forwardRef(function Transition(props, ref) { 12 | return ; 13 | }); 14 | 15 | export default function EditTodoDialog({ open, dialogHandler, todo, editTodo }) { 16 | const [editedText, setEditedText] = React.useState(todo.text); 17 | 18 | const textHandler = () => { 19 | editTodo(todo.id, editedText); 20 | dialogHandler(); 21 | }; 22 | 23 | return ( 24 | 32 | {"Editando TAREFAAAA"} 33 | 34 | setEditedText(e.target.value)} 38 | /> 39 | 40 | 41 | 42 | 43 | 44 | 45 | ); 46 | } 47 | -------------------------------------------------------------------------------- /todo-list/src/components/Form.jsx: -------------------------------------------------------------------------------- 1 | import { Button, Paper, TextField } from "@mui/material"; 2 | import React, { useState } from "react"; 3 | 4 | export default function Form({ addTodo }) { 5 | const [text, setText] = useState(null); 6 | const [id, setId] = useState(0); 7 | 8 | const todoCreate = (text) => { 9 | const todoObj = { text: text, id: id }; 10 | setId(id + 1); 11 | addTodo(todoObj); 12 | document.getElementById("outlined-basic").value = null; 13 | }; 14 | 15 | return ( 16 | 17 |
18 | setText(e.target.value)} 23 | fullWidth 24 | /> 25 | 28 |
29 |
30 | ); 31 | } 32 | -------------------------------------------------------------------------------- /todo-list/src/components/TodoItem.jsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import List from "@mui/material/List"; 3 | import ListItem from "@mui/material/ListItem"; 4 | import ListItemButton from "@mui/material/ListItemButton"; 5 | import ListItemIcon from "@mui/material/ListItemIcon"; 6 | import ListItemText from "@mui/material/ListItemText"; 7 | import Checkbox from "@mui/material/Checkbox"; 8 | import IconButton from "@mui/material/IconButton"; 9 | import CommentIcon from "@mui/icons-material/Comment"; 10 | import DeleteIcon from "@mui/icons-material/Delete"; 11 | import { Paper } from "@mui/material"; 12 | import EditTodoDialog from "./EditTodoDialog"; 13 | 14 | export default function TodoItem({ todo, deleteTodo, editTodo }) { 15 | const [openDialog, setOpenDialog] = React.useState(false); 16 | 17 | const dialogHandler = () => { 18 | setOpenDialog(!openDialog); 19 | }; 20 | 21 | return ( 22 | <> 23 | 24 | 25 | deleteTodo(todo.id)}> 28 | 29 | 30 | } 31 | disablePadding 32 | > 33 | 34 | 35 | 36 | 37 | setOpenDialog(true)} /> 38 | 39 | 40 | 41 | 42 | ); 43 | } 44 | -------------------------------------------------------------------------------- /todo-list/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /todo-list/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | document.getElementById('root') 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /todo-list/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /todo-list/src/pages/Home.jsx: -------------------------------------------------------------------------------- 1 | import { Container, List } from "@mui/material"; 2 | import React, { useState } from "react"; 3 | import Form from "../components/Form"; 4 | import TodoItem from "../components/TodoItem"; 5 | 6 | export default function Home() { 7 | const [todos, setTodos] = useState([]); 8 | const addTodo = (todo) => { 9 | setTodos([...todos, todo]); 10 | }; 11 | 12 | const deleteTodo = (id) => { 13 | var filtered = todos.filter((todo) => todo.id !== id); 14 | setTodos(filtered); 15 | }; 16 | 17 | const editTodo = (id, editedText) => { 18 | var todosArray = todos; 19 | 20 | for (var i in todosArray) { 21 | if (todosArray[i].id == id) { 22 | todosArray[i].text = editedText; 23 | } 24 | } 25 | 26 | // console.log(todosArray); 27 | // todosArray.splice(todosArray.id, 1, { text: editedText, id: id }); 28 | // console.log(todosArray); 29 | setTodos(todosArray); 30 | }; 31 | 32 | return ( 33 | 34 |
35 | 36 | {todos.map((todo) => ( 37 |
38 | 39 |
40 | ))} 41 |
42 | 43 | ); 44 | } 45 | -------------------------------------------------------------------------------- /todo-list/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /todo-list/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | --------------------------------------------------------------------------------