├── .env ├── .gitignore ├── README.md ├── package.json ├── public ├── favicon.ico ├── images │ ├── allupakoida.jpg │ ├── chola.jpg │ ├── corn.jpg │ ├── maggi.jpg │ ├── momo.jpg │ ├── nonvegthali.jpg │ ├── paubhaji.jpg │ ├── pizza.jpg │ ├── puri.jpg │ ├── rajmarice.jpg │ ├── rotiwithmeat.jpg │ ├── samosa.jpg │ ├── sweet.jpg │ ├── todo.svg │ └── vegthali.jpg ├── index.html ├── manifest.json └── robots.txt ├── src ├── App.js ├── component │ ├── Basics │ │ ├── MenuCard.js │ │ ├── Navbar.js │ │ ├── Resturant.js │ │ ├── menuApi.js │ │ └── style.css │ └── Hooks │ │ ├── style.css │ │ ├── useEffect.js │ │ ├── useReducer.js │ │ └── useState.js └── index.js └── yarn.lock /.env: -------------------------------------------------------------------------------- 1 | FAST_REFRESH=false -------------------------------------------------------------------------------- /.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 | ### `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": "reactthapaapp", 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 | }, 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/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/favicon.ico -------------------------------------------------------------------------------- /public/images/allupakoida.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/allupakoida.jpg -------------------------------------------------------------------------------- /public/images/chola.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/chola.jpg -------------------------------------------------------------------------------- /public/images/corn.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/corn.jpg -------------------------------------------------------------------------------- /public/images/maggi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/maggi.jpg -------------------------------------------------------------------------------- /public/images/momo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/momo.jpg -------------------------------------------------------------------------------- /public/images/nonvegthali.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/nonvegthali.jpg -------------------------------------------------------------------------------- /public/images/paubhaji.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/paubhaji.jpg -------------------------------------------------------------------------------- /public/images/pizza.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/pizza.jpg -------------------------------------------------------------------------------- /public/images/puri.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/puri.jpg -------------------------------------------------------------------------------- /public/images/rajmarice.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/rajmarice.jpg -------------------------------------------------------------------------------- /public/images/rotiwithmeat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/rotiwithmeat.jpg -------------------------------------------------------------------------------- /public/images/samosa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/samosa.jpg -------------------------------------------------------------------------------- /public/images/sweet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/sweet.jpg -------------------------------------------------------------------------------- /public/images/todo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/images/vegthali.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/complete_react2021/76b2900dfaba3dc794d7f14f84c6fa4315a030bd/public/images/vegthali.jpg -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 19 | 26 | 27 | 28 | 29 | React App 30 | 31 | 32 | 33 |
34 | 35 | 36 | -------------------------------------------------------------------------------- /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 Resturant from "./component/Basics/Resturant";cd 3 | // import UseState from "./component/Hooks/useState"; 4 | // import UseEffect from "./component/Hooks/useEffect"; 5 | import UseReducer from "./component/Hooks/useReducer"; 6 | 7 | const App = () => { 8 | return ; 9 | }; 10 | 11 | export default App; 12 | -------------------------------------------------------------------------------- /src/component/Basics/MenuCard.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const MenuCard = ({ menuData }) => { 4 | // console.log(menuData); 5 | 6 | return ( 7 | <> 8 |
9 | {menuData.map((curElem) => { 10 | const { id, name, category, image, description } = curElem; 11 | 12 | return ( 13 | <> 14 |
15 |
16 |
17 | {id} 18 | {category} 19 |

{name}

20 | 21 | {description} 22 | 23 |
Read
24 |
25 | images 26 | 27 | Order Now 28 |
29 |
30 | 31 | ); 32 | })} 33 |
34 | 35 | ); 36 | }; 37 | 38 | export default MenuCard; 39 | -------------------------------------------------------------------------------- /src/component/Basics/Navbar.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | const navbar = ({ filterItem, menuList }) => { 4 | return ( 5 | <> 6 | 19 | 20 | ); 21 | }; 22 | 23 | export default navbar; 24 | -------------------------------------------------------------------------------- /src/component/Basics/Resturant.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import "./style.css"; 3 | import Menu from "./menuApi.js"; 4 | import MenuCard from "./MenuCard"; 5 | import Navbar from "./Navbar"; 6 | 7 | const uniqueList = [ 8 | ...new Set( 9 | Menu.map((curElem) => { 10 | return curElem.category; 11 | }) 12 | ), 13 | "All", 14 | ]; 15 | 16 | console.log(uniqueList); 17 | 18 | const Resturant = () => { 19 | const [menuData, setMenuData] = useState(Menu); 20 | const [menuList, setMenuList] = useState(uniqueList); 21 | 22 | const filterItem = (category) => { 23 | if (category === "All") { 24 | setMenuData(Menu); 25 | return; 26 | } 27 | 28 | const updatedList = Menu.filter((curElem) => { 29 | return curElem.category === category; 30 | }); 31 | 32 | setMenuData(updatedList); 33 | }; 34 | 35 | return ( 36 | <> 37 | 38 | 39 | 40 | ); 41 | }; 42 | 43 | export default Resturant; 44 | -------------------------------------------------------------------------------- /src/component/Basics/menuApi.js: -------------------------------------------------------------------------------- 1 | const Menu = [ 2 | { 3 | id: 1, 4 | image: "images/maggi.jpg", 5 | name: "maggi", 6 | category: "breakfast", 7 | price: "12₹", 8 | description: 9 | "I love Maggi realy oo yues Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis, at consectetur totam voluptatibus quibusdam iusto. Accusamus quas, soluta ipsam autem eius necessitatibus fugiat in . ", 10 | }, 11 | 12 | { 13 | id: 2, 14 | image: "images/allupakoida.jpg", 15 | name: "allu pakoida", 16 | category: "evening", 17 | price: "20₹", 18 | description: 19 | "Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis, at consectetur totam voluptatibus quibusdam iusto. Accusamus quas, soluta ipsam autem eius necessitatibus fugiat in . ", 20 | }, 21 | { 22 | id: 3, 23 | image: "images/corn.jpg", 24 | name: "corn", 25 | category: "breakfast", 26 | price: "10₹", 27 | description: 28 | "Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis, at consectetur totam voluptatibus quibusdam iusto. Accusamus quas, soluta ipsam autem eius necessitatibus fugiat in . ", 29 | }, 30 | { 31 | id: 4, 32 | image: "../images/chola.jpg", 33 | name: "chola", 34 | category: "lunch", 35 | price: "50₹", 36 | description: 37 | "Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis, at consectetur totam voluptatibus quibusdam iusto. Accusamus quas, soluta ipsam autem eius necessitatibus fugiat in . ", 38 | }, 39 | { 40 | id: 5, 41 | image: "../images/pizza.jpg", 42 | name: "pizza", 43 | category: "evening", 44 | price: "80₹", 45 | description: 46 | "Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis, at consectetur totam voluptatibus quibusdam iusto. Accusamus quas, soluta ipsam autem eius necessitatibus fugiat in . ", 47 | }, 48 | { 49 | id: 6, 50 | image: "../images/nonvegthali.jpg", 51 | name: "Non-Veg Thali", 52 | category: "dinner", 53 | price: "180₹", 54 | description: 55 | "Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis, at consectetur totam voluptatibus quibusdam iusto. Accusamus quas, soluta ipsam autem eius necessitatibus fugiat in . ", 56 | }, 57 | { 58 | id: 7, 59 | image: "../images/sweet.jpg", 60 | name: "Sweets", 61 | category: "dinner", 62 | price: "60₹", 63 | description: 64 | "Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis, at consectetur totam voluptatibus quibusdam iusto. Accusamus quas, soluta ipsam autem eius necessitatibus fugiat in . ", 65 | }, 66 | { 67 | id: 8, 68 | image: "../images/rajmarice.jpg", 69 | name: "Rajma Rice", 70 | category: "lunch", 71 | price: "60₹", 72 | description: 73 | "Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis, at consectetur totam voluptatibus quibusdam iusto. Accusamus quas, soluta ipsam autem eius necessitatibus fugiat in . ", 74 | }, 75 | { 76 | id: 9, 77 | image: "../images/samosa.jpg", 78 | name: "samaso", 79 | category: "evening", 80 | price: "10₹", 81 | description: 82 | "Lorem ipsum dolor sit amet consectetur adipisicing elit. Blanditiis, at consectetur totam voluptatibus quibusdam iusto. Accusamus quas, soluta ipsam autem eius necessitatibus fugiat in . ", 83 | }, 84 | ]; 85 | 86 | export default Menu; 87 | -------------------------------------------------------------------------------- /src/component/Basics/style.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | box-sizing: border-box; 5 | font-family: "Lato", sans-serif; 6 | } 7 | 8 | html { 9 | background: #faf7f2; 10 | background-image: url(https://s3.postimg.org/s1n3ji1ur/paper_fibers_2_X.png); 11 | box-sizing: border-box; 12 | font-family: "Lato", sans-serif; 13 | font-size: 14px; 14 | font-weight: 400; 15 | } 16 | 17 | *, 18 | *:before, 19 | *:after { 20 | box-sizing: inherit; 21 | } 22 | 23 | .subtle { 24 | color: #aaa; 25 | } 26 | 27 | .main-card--cointainer { 28 | display: grid; 29 | grid-template-columns: repeat(3, minmax(300px, 500px)); 30 | grid-gap: 50px; 31 | justify-content: space-around; 32 | } 33 | 34 | .card-container { 35 | margin: 25px auto 0; 36 | position: relative; 37 | display: grid; 38 | grid-template-columns: 1fr; 39 | justify-content: space-around; 40 | align-items: flex-start; 41 | } 42 | 43 | .card-container img { 44 | max-width: 100%; 45 | height: 300px; 46 | } 47 | 48 | .card { 49 | background-color: #fff; 50 | padding: 30px; 51 | position: relative; 52 | box-shadow: 0 0 5px rgba(75, 75, 75, 0.07); 53 | z-index: 1; 54 | } 55 | 56 | .card-body { 57 | display: inline-block; 58 | } 59 | 60 | .card-number { 61 | margin-top: 15px; 62 | } 63 | 64 | .card-circle { 65 | border: 1px solid #aaa; 66 | border-radius: 50%; 67 | display: inline-block; 68 | line-height: 22px; 69 | font-size: 12px; 70 | height: 25px; 71 | text-align: center; 72 | width: 25px; 73 | } 74 | 75 | .card-author { 76 | display: block; 77 | font-size: 12px; 78 | letter-spacing: 0.5px; 79 | margin: 15px 0 0; 80 | text-transform: uppercase; 81 | } 82 | 83 | .card-title { 84 | font-family: "Cormorant Garamond", serif; 85 | font-size: 60px; 86 | font-weight: 300; 87 | line-height: 60px; 88 | margin: 10px 0; 89 | text-transform: capitalize; 90 | } 91 | 92 | .card-description { 93 | /* display: inline-block; */ 94 | font-weight: 300; 95 | line-height: 22px; 96 | margin: 10px 0; 97 | } 98 | 99 | .card-read { 100 | cursor: pointer; 101 | font-size: 14px; 102 | font-weight: 700; 103 | letter-spacing: 6px; 104 | margin: 5px 0 20px; 105 | position: relative; 106 | text-align: right; 107 | text-transform: uppercase; 108 | } 109 | 110 | .card-read:after { 111 | background-color: #b8bddd; 112 | content: ""; 113 | display: block; 114 | height: 1px; 115 | position: absolute; 116 | top: 9px; 117 | width: 75%; 118 | } 119 | 120 | .card-tag { 121 | float: right; 122 | margin: 5px 0 0; 123 | border: 1px solid #aaa; 124 | padding: 5px 10px; 125 | cursor: pointer; 126 | } 127 | 128 | .card-tag:hover { 129 | background: #aaa; 130 | color: black; 131 | } 132 | 133 | .card-media { 134 | max-width: 100%; 135 | height: auto; 136 | } 137 | 138 | .card-shadow { 139 | background-color: #fff; 140 | box-shadow: 0 2px 25px 2px rgba(0, 0, 0, 1), 0 2px 50px 2px rgba(0, 0, 0, 1), 141 | 0 0 100px 3px rgba(0, 0, 0, 0.25); 142 | height: 1px; 143 | margin: -1px auto 0; 144 | width: 80%; 145 | z-index: -1; 146 | } 147 | 148 | @media (max-width: 998px) { 149 | .main-card--cointainer { 150 | display: grid; 151 | grid-template-columns: repeat(1, minmax(200px, 500px)); 152 | grid-gap: 50px; 153 | justify-content: space-around; 154 | } 155 | } 156 | 157 | /* ---------- Button styles ------------------ */ 158 | 159 | .navbar { 160 | padding-top: 50px; 161 | text-align: center; 162 | } 163 | 164 | .navbar h1 { 165 | padding-bottom: 20px; 166 | text-transform: capitalize; 167 | } 168 | 169 | /** button group styles **/ 170 | .btn-group { 171 | border-radius: 1rem; 172 | text-transform: capitalize; 173 | } 174 | .btn-group__item { 175 | border: none; 176 | /* min-width: 6rem; */ 177 | padding: 1.5rem 3rem; 178 | background-color: rgb(255, 255, 255); 179 | cursor: pointer; 180 | margin: 0; 181 | font-size: 17px; 182 | box-shadow: inset 0px 0px 0px -15px rebeccapurple; 183 | transition: all 300ms ease-out; 184 | text-transform: capitalize; 185 | } 186 | .btn-group__item:last-child { 187 | border-top-right-radius: 1rem; 188 | border-bottom-right-radius: 1rem; 189 | } 190 | .btn-group__item:first-child { 191 | border-top-left-radius: 1rem; 192 | border-bottom-left-radius: 1rem; 193 | } 194 | .btn-group__item:hover, 195 | .btn-group__item:focus { 196 | color: rebeccapurple; 197 | box-shadow: inset 0px -20px 0px -15px rebeccapurple; 198 | } 199 | .btn-group__item:focus { 200 | outline: none; 201 | } 202 | .btn-group__item:after { 203 | content: "✔️"; 204 | margin-left: 0.5rem; 205 | display: inline-block; 206 | color: rebeccapurple; 207 | position: absolute; 208 | transform: translatey(10px); 209 | opacity: 0; 210 | transition: all 200ms ease-out; 211 | } 212 | .btn-group__item--active:after { 213 | opacity: 1; 214 | transform: translatey(-2px); 215 | } 216 | -------------------------------------------------------------------------------- /src/component/Hooks/style.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css2?family=Roboto&display=swap"); 2 | body { 3 | display: flex; 4 | justify-content: center; 5 | align-items: center; 6 | height: 100vh; 7 | background: #060505; 8 | } 9 | 10 | .button { 11 | border: 2px solid #d2bdff; 12 | height: 80px; 13 | width: 200px; 14 | border-radius: 4px; 15 | position: relative; 16 | cursor: pointer; 17 | font-family: "Roboto", sans-serif; 18 | margin: 25px; 19 | } 20 | .button::after { 21 | content: "HOVER ME"; 22 | position: absolute; 23 | top: 41%; 24 | left: 50%; 25 | transform: translate(-50%); 26 | color: #d2bdff; 27 | transition: all 0.1s linear; 28 | } 29 | .button::before { 30 | content: ""; 31 | position: relative; 32 | display: block; 33 | height: 15px; 34 | width: 15px; 35 | background: #d2bdff; 36 | box-shadow: 0px 0px 10px 3px #0ff; 37 | margin-left: -8px; 38 | margin-top: -8px; 39 | opacity: 0; 40 | transition: all 0.1s linear; 41 | border-radius: 100%; 42 | animation: star 1.3s linear infinite; 43 | } 44 | @keyframes star { 45 | 0% { 46 | margin-left: -8px; 47 | margin-top: -8px; 48 | } 49 | 25% { 50 | margin-left: 194px; 51 | margin-top: -8px; 52 | } 53 | 50% { 54 | margin-left: 194px; 55 | margin-top: 75px; 56 | } 57 | 75% { 58 | margin-left: -8px; 59 | margin-top: 75px; 60 | } 61 | 100% { 62 | margin-left: -8px; 63 | margin-top: -8px; 64 | } 65 | } 66 | .button:hover::before { 67 | opacity: 1; 68 | animation: star 1.3s linear infinite; 69 | } 70 | .button:hover::after { 71 | content: "I'M GLOWING"; 72 | text-shadow: 0 0 10px #fff, 0 0 10px #fff, 0 0 20px #82bedc, 0 0 30px #82bedc, 73 | 0 0 40px #82bedc, 0 0 50px #82bedc, 0 0 60px #82bedc; 74 | } 75 | 76 | .button2 { 77 | position: relative; 78 | display: inline-block; 79 | padding: 30px 61px; 80 | border-radius: 4px; 81 | color: #03e9f4; 82 | text-decoration: none; 83 | text-transform: uppercase; 84 | overflow: hidden; 85 | margin: 25px; 86 | font-family: "Roboto", sans-serif; 87 | filter: hue-rotate(0deg); 88 | border: 2px solid #d2bdff; 89 | transition: all 0.1s linear; 90 | cursor: pointer; 91 | } 92 | .button2:hover { 93 | border: 1px solid transparent; 94 | } 95 | .button2:hover span { 96 | position: absolute; 97 | display: block; 98 | } 99 | .button2:hover span:nth-child(1) { 100 | filter: hue-rotate(0deg); 101 | top: 0; 102 | left: 0; 103 | width: 100%; 104 | height: 3px; 105 | background: linear-gradient(90deg, transparent, #3a86ff); 106 | animation: animate1 1s linear infinite; 107 | } 108 | @keyframes animate1 { 109 | 0% { 110 | left: -100%; 111 | } 112 | 50%, 113 | 100% { 114 | left: 100%; 115 | } 116 | } 117 | .button2:hover span:nth-child(2) { 118 | filter: hue-rotate(60deg); 119 | top: -100%; 120 | right: 0; 121 | width: 3px; 122 | height: 100%; 123 | background: linear-gradient(180deg, transparent, #3a86ff); 124 | animation: animate2 1s linear infinite; 125 | animation-delay: 0.25s; 126 | } 127 | @keyframes animate2 { 128 | 0% { 129 | top: -100%; 130 | } 131 | 50%, 132 | 100% { 133 | top: 100%; 134 | } 135 | } 136 | .button2:hover span:nth-child(3) { 137 | filter: hue-rotate(120deg); 138 | bottom: 0; 139 | right: 0; 140 | width: 100%; 141 | background: linear-gradient(270deg, transparent, #3a86ff); 142 | animation: animate3 1s linear infinite; 143 | animation-delay: 0.5s; 144 | } 145 | @keyframes animate3 { 146 | 0% { 147 | right: -100%; 148 | height: 3px; 149 | } 150 | 50%, 151 | 100% { 152 | height: 2px; 153 | right: 100%; 154 | } 155 | } 156 | .button2:hover span:nth-child(4) { 157 | filter: hue-rotate(300deg); 158 | bottom: -100%; 159 | left: 0; 160 | width: 3px; 161 | height: 100%; 162 | background: linear-gradient(360deg, transparent, #3a86ff); 163 | animation: animate4 1s linear infinite; 164 | animation-delay: 0.75s; 165 | } 166 | @keyframes animate4 { 167 | 0% { 168 | bottom: -100%; 169 | } 170 | 50%, 171 | 100% { 172 | bottom: 100%; 173 | } 174 | } 175 | 176 | P { 177 | color: #fff; 178 | text-align: center; 179 | font-size: 60px; 180 | margin-bottom: 50px; 181 | } 182 | -------------------------------------------------------------------------------- /src/component/Hooks/useEffect.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from "react"; 2 | import "./style.css"; 3 | 4 | const UseEffect = () => { 5 | // const initialData = 15; 6 | const [myNum, setMyNum] = useState(0); 7 | 8 | useEffect(() => { 9 | document.title = `Chats(${myNum})`; 10 | }); 11 | 12 | return ( 13 | <> 14 |
15 |

{myNum}

16 |
setMyNum(myNum + 1)}> 17 | 18 | 19 | 20 | 21 | INCR 22 |
23 |
24 | 25 | ); 26 | }; 27 | 28 | export default UseEffect; 29 | -------------------------------------------------------------------------------- /src/component/Hooks/useReducer.js: -------------------------------------------------------------------------------- 1 | import React, { useReducer } from "react"; 2 | import "./style.css"; 3 | 4 | const reducer = (state, action) => { 5 | if (action.type === "INCR") { 6 | state = state + 1; 7 | } 8 | 9 | if (state > 0 && action.type === "DECR") { 10 | state = state - 1; 11 | } 12 | return state; 13 | }; 14 | 15 | const UseReducer = () => { 16 | // const initialData = 15; 17 | // const [myNum, setMyNum] = React.useState(0); 18 | const intialData = 10; 19 | const [state, dispatch] = useReducer(reducer, intialData); 20 | 21 | return ( 22 | <> 23 |
24 |

{state}

25 |
dispatch({ type: "INCR" })}> 26 | 27 | 28 | 29 | 30 | INCR 31 |
32 |
dispatch({ type: "DECR" })}> 33 | 34 | 35 | 36 | 37 | DECR 38 |
39 |
40 | 41 | ); 42 | }; 43 | 44 | export default UseReducer; 45 | -------------------------------------------------------------------------------- /src/component/Hooks/useState.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import "./style.css"; 3 | 4 | const UseState = () => { 5 | // const initialData = 15; 6 | const [myNum, setMyNum] = React.useState(0); 7 | 8 | return ( 9 | <> 10 |
11 |

{myNum}

12 |
setMyNum(myNum + 1)}> 13 | 14 | 15 | 16 | 17 | INCR 18 |
19 |
(myNum > 0 ? setMyNum(myNum - 1) : setMyNum(0))}> 22 | 23 | 24 | 25 | 26 | DECR 27 |
28 |
29 | 30 | ); 31 | }; 32 | 33 | export default UseState; 34 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import App from "./App"; 4 | 5 | ReactDOM.render( 6 | 7 | 8 | , 9 | document.getElementById("root") 10 | ); 11 | --------------------------------------------------------------------------------