├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt └── src ├── App.js ├── Avatar.jsx ├── BookCard.jsx ├── Counterr.jsx ├── Home.js ├── Navbar.js ├── Posts.jsx ├── counter.css ├── index.js └── style.css /.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 | -------------------------------------------------------------------------------- /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 | # CA20_REACT_APP 72 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ca_react_app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.16.5", 7 | "@testing-library/react": "^13.4.0", 8 | "@testing-library/user-event": "^13.5.0", 9 | "react": "^18.2.0", 10 | "react-dom": "^18.2.0", 11 | "react-scripts": "5.0.1", 12 | "web-vitals": "^2.1.4" 13 | }, 14 | "scripts": { 15 | "start": "react-scripts start", 16 | "build": "react-scripts build", 17 | "test": "react-scripts test", 18 | "eject": "react-scripts eject" 19 | }, 20 | "eslintConfig": { 21 | "extends": [ 22 | "react-app", 23 | "react-app/jest" 24 | ] 25 | }, 26 | "browserslist": { 27 | "production": [ 28 | ">0.2%", 29 | "not dead", 30 | "not op_mini all" 31 | ], 32 | "development": [ 33 | "last 1 chrome version", 34 | "last 1 firefox version", 35 | "last 1 safari version" 36 | ] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmed-moha/CA20_REACT_APP/6054baf00d6838fbcb645a258e4818625eab3282/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 19 | CA209 REACT APP 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmed-moha/CA20_REACT_APP/6054baf00d6838fbcb645a258e4818625eab3282/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmed-moha/CA20_REACT_APP/6054baf00d6838fbcb645a258e4818625eab3282/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.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Home from './Home'; 3 | import Navbar from './Navbar'; 4 | import "./style.css" 5 | function App() { 6 | const isLoading=true; 7 | // if(isLoading) return

Loading...

8 | return ( 9 | 10 |
11 | 12 |
13 | {isLoading && } 14 |
15 |
16 | ) 17 | } 18 | 19 | export default App 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Avatar.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | function Avatar({ imageUrl }) { 4 | return ( 5 |
6 | sample image 7 |
8 | ) 9 | } 10 | 11 | export default Avatar 12 | -------------------------------------------------------------------------------- /src/BookCard.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | function BookCard({ books, deleteBook }) { 4 | 5 | return ( 6 |
7 | { 8 | books.map((book) =>
9 |

{book.title}

10 |

{book.body}

11 | 12 |
) 13 | } 14 |
15 | ) 16 | } 17 | 18 | export default BookCard 19 | -------------------------------------------------------------------------------- /src/Counterr.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react' 2 | import "./counter.css" 3 | function Counter() { 4 | let [counter, setCounter] = useState(0); 5 | 6 | const addCounter = () => { 7 | setCounter(counter + 1) 8 | 9 | } 10 | const subCounter = () => { 11 | if (counter > 0) { 12 | setCounter(counter - 1) 13 | } 14 | 15 | } 16 | return ( 17 |
18 |

Counter App

19 | 20 |

{counter}

21 | 22 | 23 |
24 | ) 25 | } 26 | 27 | export default Counter 28 | -------------------------------------------------------------------------------- /src/Home.js: -------------------------------------------------------------------------------- 1 | import { click } from '@testing-library/user-event/dist/click'; 2 | import { useState } from 'react' 3 | // import Avatar from './Avatar' 4 | // import Posts from './Posts' 5 | import Counter from './Counterr'; 6 | import BookCard from './BookCard'; 7 | 8 | 9 | function Home() { 10 | const [books, setBooks] = useState([ 11 | { 12 | title: "14 things I wish I knew at 25 (now that I’m 38)", 13 | body: "Lorem ipsum.....", 14 | author: "Ahmed", 15 | id: 1, 16 | }, 17 | { 18 | title: "Stop requiring innovation heroism!", 19 | body: "Lorem ipsum.....", 20 | author: "Hassan", 21 | id: 2, 22 | }, 23 | { 24 | title: "How to Become a Good Backend Engineer (Fundamentals)", 25 | body: "Lorem ipsum.....", 26 | author: "Farxiya", 27 | id: 3, 28 | }, 29 | ]) 30 | 31 | const deleteBook = (id) => { 32 | let newBooks = books.filter((book) => book.id != id); 33 | setBooks(newBooks); 34 | } 35 | // const posts=[ 36 | // { 37 | // id:1, 38 | // post:"some text" 39 | // }, 40 | // { 41 | // id:2, 42 | // post:"some text 2" 43 | // } 44 | // ] 45 | // const name="Ahmed"; 46 | 47 | 48 | 49 | // let name="Welcome CA206"; 50 | // let [name, setName] = useState("Welcome CA206") // Reactive variable 51 | // let [age, setAge] = useState(23); 52 | // const clickMe = () => { 53 | // setName("Welcome CA207") 54 | // console.log("HELLO ", name); 55 | // } 56 | 57 | return ( 58 | 59 |
60 | 61 | {/*

{name}

*/} 62 | 63 | 70 | 71 | {/* 72 |

{age}

73 | */} 76 | {/* */} 77 | 78 | {/* */} 79 | 80 | 81 |
82 | ) 83 | } 84 | 85 | export default Home 86 | -------------------------------------------------------------------------------- /src/Navbar.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | function Navbar() { 4 | return ( 5 |
6 | 18 | 19 |
20 | ) 21 | } 22 | 23 | export default Navbar 24 | -------------------------------------------------------------------------------- /src/Posts.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | function Posts({xog,title}) { 4 | 5 | 6 | return ( 7 |
8 |

{title}

9 | { 10 | xog.map((item, index) =>
  • {item.post}
  • ) 11 | } 12 |
    13 | ) 14 | } 15 | 16 | export default Posts 17 | -------------------------------------------------------------------------------- /src/counter.css: -------------------------------------------------------------------------------- 1 | .content{ 2 | border: 2px solid cyan; 3 | border-radius: 9px; 4 | padding: 10px; 5 | 6 | width: 110px; 7 | margin-left: 40%; 8 | 9 | } 10 | 11 | .content h1{ 12 | background-color: blue; 13 | color: white; 14 | padding: 0; 15 | border-radius: 10px; 16 | text-align: center; 17 | margin-top: 10px; 18 | } 19 | 20 | .content p { 21 | text-align: center; 22 | } 23 | 24 | .btnAdd{ 25 | background-color: green; 26 | color: aliceblue; 27 | border-radius: 10px; 28 | padding: 12px; 29 | border: none; 30 | text-align: center; 31 | margin-top: 10px; 32 | font-size: medium; 33 | } 34 | .btnSub{ 35 | background-color: red; 36 | color: aliceblue; 37 | border-radius: 10px; 38 | padding: 12px; 39 | border: none; 40 | text-align: center; 41 | margin-top: 10px; 42 | font-size: medium; 43 | margin-left: 45px; 44 | } -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | import ReactDOM from "react-dom/client"; 4 | 5 | import App from "./App"; 6 | 7 | const root = ReactDOM.createRoot(document.getElementById("root")); 8 | root.render( 9 | 10 | ) 11 | // ReactDOM.render(,document.getElementById("root")) -------------------------------------------------------------------------------- /src/style.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap'); 2 | 3 | /* base styles */ 4 | * { 5 | margin: 0; 6 | font-family: "Quicksand"; 7 | color: #333; 8 | } 9 | .navbar { 10 | padding: 20px; 11 | display: flex; 12 | align-items: center; 13 | max-width: 600px; 14 | margin: 0 auto; 15 | border-bottom: 1px solid #f2f2f2; 16 | } 17 | .navbar h1 { 18 | color: purple; 19 | } 20 | .navbar .links { 21 | margin-left: auto; 22 | } 23 | .navbar a { 24 | margin-left: 16px; 25 | text-decoration: none; 26 | padding: 6px; 27 | } 28 | .navbar a:hover { 29 | color: #f1356d; 30 | } 31 | .content { 32 | max-width: 600px; 33 | margin: 40px auto; 34 | padding: 20px; 35 | } 36 | 37 | 38 | .bookCard{ 39 | padding: 10px 16px; 40 | margin: 20px 0; 41 | border-bottom: 1px solid pink; 42 | } 43 | 44 | .bookCard:hover{ 45 | box-shadow: 1px 3px 5px blanchedalmond; 46 | } 47 | 48 | .bookCard h2{ 49 | font-size: 20px; 50 | color: #f1356d; 51 | margin-bottom: 8px; 52 | } --------------------------------------------------------------------------------