├── .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 ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt ├── src ├── App.css ├── App.js ├── App.test.js ├── components │ ├── todoreact │ │ ├── style.css │ │ └── todo.js │ └── weather │ │ ├── style.css │ │ ├── temp.js │ │ └── weathercard.js ├── index.css ├── index.js ├── logo.svg ├── reportWebVitals.js └── setupTests.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /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": "complete_reactjs", 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/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/favicon.ico -------------------------------------------------------------------------------- /public/images/allupakoida.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/images/allupakoida.jpg -------------------------------------------------------------------------------- /public/images/chola.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/images/chola.jpg -------------------------------------------------------------------------------- /public/images/corn.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/images/corn.jpg -------------------------------------------------------------------------------- /public/images/maggi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/images/maggi.jpg -------------------------------------------------------------------------------- /public/images/momo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/images/momo.jpg -------------------------------------------------------------------------------- /public/images/nonvegthali.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/images/nonvegthali.jpg -------------------------------------------------------------------------------- /public/images/paubhaji.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/images/paubhaji.jpg -------------------------------------------------------------------------------- /public/images/pizza.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/images/pizza.jpg -------------------------------------------------------------------------------- /public/images/puri.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/images/puri.jpg -------------------------------------------------------------------------------- /public/images/rajmarice.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/images/rajmarice.jpg -------------------------------------------------------------------------------- /public/images/rotiwithmeat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/images/rotiwithmeat.jpg -------------------------------------------------------------------------------- /public/images/samosa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/images/samosa.jpg -------------------------------------------------------------------------------- /public/images/sweet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/images/sweet.jpg -------------------------------------------------------------------------------- /public/images/todo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/images/vegthali.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/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/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thapatechnical/reactjsByThapaTechnical/fdfcb12eac37b74d060e344e977df5749a939200/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.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Todo from "./components/todoreact/todo"; 3 | // import Temp from "./components/weather/temp"; 4 | 5 | const App = () => { 6 | return ( 7 | <> 8 | 9 | 10 | ); 11 | }; 12 | 13 | export default App; 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/components/todoreact/style.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300&display=swap"); 2 | 3 | * { 4 | margin: 0; 5 | padding: 0; 6 | box-sizing: border-box; 7 | font-family: "Source Sans Pro", sans-serif; 8 | } 9 | 10 | html { 11 | font-size: 62.5%; 12 | } 13 | 14 | .main-div { 15 | min-height: 100vh; 16 | background: #060822; 17 | display: flex; 18 | justify-content: center; 19 | /* align-items: center; */ 20 | } 21 | 22 | .child-div { 23 | text-align: center; 24 | margin-top: 12rem; 25 | } 26 | 27 | .child-div figure img { 28 | width: 10rem; 29 | height: 8rem; 30 | } 31 | 32 | .child-div figure figcaption { 33 | color: #fff; 34 | font-size: 2.2rem; 35 | padding-top: 2rem; 36 | text-transform: capitalize; 37 | } 38 | 39 | input { 40 | /* display: block; */ 41 | min-width: 40rem; 42 | height: 3.4rem; 43 | padding: 2rem 1.2rem; 44 | font-size: 1.8rem; 45 | line-height: 1.42857143; 46 | margin-top: 2rem; 47 | color: rgb(58, 57, 57); 48 | background-color: #fff; 49 | background-image: none; 50 | border: 0.1rem solid #ccc; 51 | border-radius: 0.4rem; 52 | -webkit-box-shadow: inset 0 0.1rem 0.1rem rgb(0 0 0 / 8%); 53 | box-shadow: inset 0 0.1rem 0.1rem rgb(0 0 0 / 8%); 54 | transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; 55 | } 56 | 57 | input, 58 | input:focus, 59 | input:active, 60 | input:active:focus { 61 | border: none; 62 | padding: 2.3rem 1.5rem; 63 | outline: none; 64 | } 65 | input { 66 | -webkit-box-shadow: none; 67 | box-shadow: none; 68 | -webkit-transition: all 0.2s linear; 69 | transition: all 0.2s linear; 70 | } 71 | input:focus { 72 | -webkit-box-shadow: 0 0 1.5rem rgba(0, 0, 0, 0.2); 73 | box-shadow: 0 0 1.5rem rgba(0, 0, 0, 0.2); 74 | } 75 | 76 | /* Please Subscribe to ThapaTechnical Youtube Channel 77 | /* Click Here: https://www.youtube.com/thapatechnical */ 78 | 79 | .todo-btn { 80 | width: 5rem; 81 | display: flex; 82 | justify-content: space-around; 83 | } 84 | 85 | .fa { 86 | margin-left: -2.5rem; 87 | cursor: pointer; 88 | pointer-events: auto; 89 | z-index: 10; 90 | background-color: #fff; 91 | background-image: none; 92 | color: #666; 93 | -webkit-transition: color 0.15s linear; 94 | transition: color 0.15s linear; 95 | font-size: 2rem; 96 | } 97 | .fa:hover { 98 | color: rgb(47, 214, 122); 99 | } 100 | 101 | .fa-plus:before { 102 | content: "\f067"; 103 | font-size: 1.5rem; 104 | } 105 | 106 | .showItems { 107 | margin-top: 3rem; 108 | text-align: center; 109 | } 110 | 111 | .eachItem { 112 | background: #fff; 113 | padding: 1.2rem 1rem; 114 | border-radius: 0.5rem; 115 | margin-bottom: 0.7rem; 116 | margin-left: 1rem; 117 | min-width: 40rem; 118 | word-break: break-word; 119 | background: rgb(85, 41, 220); 120 | display: flex; 121 | justify-content: space-between; 122 | align-items: center; 123 | } 124 | 125 | .eachItem:hover { 126 | background: rgb(249, 249, 252); 127 | color: rgb(85, 41, 220); 128 | } 129 | 130 | .showItems .eachItem h3 { 131 | padding-left: 1rem; 132 | font-size: 1.6rem; 133 | color: #fff; 134 | } 135 | 136 | .fa-trash-alt, 137 | .fa-edit { 138 | /* margin-left: -2.5rem; */ 139 | cursor: pointer; 140 | pointer-events: auto; 141 | z-index: 10; 142 | color: rgb(251, 251, 251); 143 | -webkit-transition: color 0.15s linear; 144 | transition: color 0.15s linear; 145 | font-size: 2rem; 146 | } 147 | 148 | .addItems .fa-edit { 149 | color: rgb(47, 214, 122); 150 | } 151 | 152 | .fa-edit { 153 | margin-left: -3.5rem; 154 | } 155 | 156 | /* Please Subscribe to ThapaTechnical Youtube Channel 157 | /* Click Here: https://www.youtube.com/thapatechnical */ 158 | 159 | .eachItem:hover .fa-trash-alt { 160 | color: rgb(214, 47, 61); 161 | } 162 | 163 | .eachItem:hover .fa-edit { 164 | color: rgb(100, 214, 47); 165 | } 166 | 167 | .eachItem:hover h3 { 168 | color: rgb(85, 41, 220); 169 | } 170 | 171 | .btn { 172 | letter-spacing: 0.1em; 173 | cursor: pointer; 174 | font-size: 14px; 175 | font-weight: 400; 176 | line-height: 45px; 177 | max-width: 160px; 178 | position: relative; 179 | text-decoration: none; 180 | text-transform: uppercase; 181 | width: 100%; 182 | } 183 | .btn:hover { 184 | text-decoration: none; 185 | } 186 | 187 | .effect04 { 188 | --uismLinkDisplay: var(--smLinkDisplay, inline-flex); 189 | display: var(--uismLinkDisplay); 190 | color: #000; 191 | outline: solid 2px #000; 192 | position: relative; 193 | transition-duration: 0.4s; 194 | overflow: hidden; 195 | } 196 | 197 | .effect04::before, 198 | .effect04 span { 199 | margin: 0 auto; 200 | transition-timing-function: cubic-bezier(0.86, 0, 0.07, 1); 201 | transition-duration: 0.4s; 202 | } 203 | 204 | .effect04:hover { 205 | background-color: rgb(85, 41, 220); 206 | } 207 | 208 | .effect04:hover span { 209 | -webkit-transform: translateY(-400%) scale(-0.1, 20); 210 | transform: translateY(-400%) scale(-0.1, 20); 211 | } 212 | 213 | .effect04::before { 214 | content: attr(data-sm-link-text); 215 | color: #fff; 216 | position: absolute; 217 | left: 0; 218 | right: 0; 219 | margin: auto; 220 | -webkit-transform: translateY(500%) scale(-0.1, 20); 221 | transform: translateY(500%) scale(-0.1, 20); 222 | } 223 | 224 | .effect04:hover::before { 225 | letter-spacing: 0.05em; 226 | -webkit-transform: translateY(0) scale(1, 1); 227 | transform: translateY(0) scale(1, 1); 228 | } 229 | -------------------------------------------------------------------------------- /src/components/todoreact/todo.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from "react"; 2 | import "./style.css"; 3 | 4 | // get the localStorage data back 5 | const getLocalData = () => { 6 | const lists = localStorage.getItem("mytodolist"); 7 | 8 | if (lists) { 9 | return JSON.parse(lists); 10 | } else { 11 | return []; 12 | } 13 | }; 14 | 15 | const Todo = () => { 16 | const [inputdata, setInputData] = useState(""); 17 | const [items, setItems] = useState(getLocalData()); 18 | const [isEditItem, setIsEditItem] = useState(""); 19 | const [toggleButton, setToggleButton] = useState(false); 20 | 21 | // add the items fucnction 22 | const addItem = () => { 23 | if (!inputdata) { 24 | alert("plz fill the data"); 25 | } else if (inputdata && toggleButton) { 26 | setItems( 27 | items.map((curElem) => { 28 | if (curElem.id === isEditItem) { 29 | return { ...curElem, name: inputdata }; 30 | } 31 | return curElem; 32 | }) 33 | ); 34 | 35 | setInputData(""); 36 | setIsEditItem(null); 37 | setToggleButton(false); 38 | } else { 39 | const myNewInputData = { 40 | id: new Date().getTime().toString(), 41 | name: inputdata, 42 | }; 43 | setItems([...items, myNewInputData]); 44 | setInputData(""); 45 | } 46 | }; 47 | 48 | //edit the items 49 | const editItem = (index) => { 50 | const item_todo_edited = items.find((curElem) => { 51 | return curElem.id === index; 52 | }); 53 | setInputData(item_todo_edited.name); 54 | setIsEditItem(index); 55 | setToggleButton(true); 56 | }; 57 | 58 | // how to delete items section 59 | const deleteItem = (index) => { 60 | const updatedItems = items.filter((curElem) => { 61 | return curElem.id !== index; 62 | }); 63 | setItems(updatedItems); 64 | }; 65 | 66 | // remove all the elements 67 | const removeAll = () => { 68 | setItems([]); 69 | }; 70 | 71 | // adding localStorage 72 | useEffect(() => { 73 | localStorage.setItem("mytodolist", JSON.stringify(items)); 74 | }, [items]); 75 | 76 | return ( 77 | <> 78 |
79 |
80 |
81 | todologo 82 |
Add Your List Here ✌
83 |
84 |
85 | setInputData(event.target.value)} 91 | /> 92 | {toggleButton ? ( 93 | 94 | ) : ( 95 | 96 | )} 97 |
98 | {/* show our items */} 99 |
100 | {items.map((curElem) => { 101 | return ( 102 |
103 |

{curElem.name}

104 |
105 | editItem(curElem.id)}> 108 | deleteItem(curElem.id)}> 111 |
112 |
113 | ); 114 | })} 115 |
116 | 117 | {/* rmeove all button */} 118 |
119 | 125 |
126 |
127 |
128 | 129 | ); 130 | }; 131 | 132 | export default Todo; 133 | -------------------------------------------------------------------------------- /src/components/weather/style.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Poiret+One); 2 | 3 | @import url(https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.min.css); 4 | 5 | * { 6 | margin: 0; 7 | padding: 0; 8 | box-sizing: border-box; 9 | } 10 | 11 | :root { 12 | --rad: 0.7rem; 13 | --dur: 0.3s; 14 | --color-dark: #2f2f2f; 15 | --color-light: #fff; 16 | --color-brand: #57bd84; 17 | --font-fam: "Lato", sans-serif; 18 | --height: 5rem; 19 | --btn-width: 6rem; 20 | --bez: cubic-bezier(0, 0, 0.43, 1.49); 21 | } 22 | 23 | body { 24 | background-color: #f5f5f5; 25 | background: var(--color-dark); 26 | height: 100vh; 27 | min-height: 100vh; 28 | display: grid; 29 | place-items: center; 30 | } 31 | 32 | .widget { 33 | display: flex; 34 | height: 400px; 35 | width: 650px; 36 | flex-wrap: wrap; 37 | cursor: pointer; 38 | border-radius: 20px; 39 | box-shadow: 0 27px 55px 0 rgba(0, 0, 0, 0.3), 40 | 0 17px 17px 0 rgba(0, 0, 0, 0.15); 41 | } 42 | .widget .weatherIcon { 43 | flex: 1 100%; 44 | height: 50%; 45 | border-top-left-radius: 20px; 46 | border-top-right-radius: 20px; 47 | background: #fafafa; 48 | font-family: weathericons; 49 | display: flex; 50 | align-items: center; 51 | justify-content: space-around; 52 | font-size: 100px; 53 | } 54 | 55 | .widget .weatherInfo { 56 | flex: 0 0 70%; 57 | height: 40%; 58 | background: #080705; 59 | display: flex; 60 | align-items: center; 61 | color: white; 62 | } 63 | .widget .weatherInfo .temperature { 64 | flex: 0 0 40%; 65 | width: 100%; 66 | font-size: 65px; 67 | display: flex; 68 | justify-content: space-around; 69 | margin-right: 20px; 70 | } 71 | .widget .weatherInfo .description { 72 | flex: 0 60%; 73 | display: flex; 74 | flex-direction: column; 75 | width: 100%; 76 | height: 100%; 77 | justify-content: center; 78 | } 79 | .widget .weatherInfo .description .weatherCondition { 80 | text-transform: uppercase; 81 | font-size: 35px; 82 | font-weight: 100; 83 | } 84 | .widget .weatherInfo .description .place { 85 | font-size: 15px; 86 | } 87 | .widget .date { 88 | flex: 0 0 30%; 89 | height: 40%; 90 | background: #70c1b3; 91 | display: flex; 92 | justify-content: space-around; 93 | align-items: center; 94 | color: white; 95 | font-size: 30px; 96 | font-weight: 800; 97 | text-align: center; 98 | } 99 | 100 | .widget .extra-temp { 101 | flex: 1 100%; 102 | padding: 5% 0; 103 | border-bottom-left-radius: 20px; 104 | border-bottom-right-radius: 20px; 105 | background: #fafafa; 106 | display: grid; 107 | grid-template-columns: repeat(2, 1fr); 108 | align-items: center; 109 | font-size: 100px; 110 | } 111 | 112 | .widget .extra-temp p { 113 | font-size: 25px; 114 | font-weight: 600; 115 | } 116 | 117 | .temp-info-minmax, 118 | .weather-extra-info, 119 | .two-sided-section { 120 | display: grid; 121 | grid-template-columns: repeat(2, 1fr); 122 | text-align: center; 123 | align-items: center; 124 | color: #70c1b3; 125 | /* background-color: blanchedalmond; */ 126 | } 127 | 128 | .widget .extra-temp .extra-info-leftside { 129 | text-align: left; 130 | font-weight: 600; 131 | text-transform: capitalize; 132 | color: #080705; 133 | font-size: 15px; 134 | } 135 | 136 | /* input search button style */ 137 | 138 | .search { 139 | width: 100%; 140 | position: relative; 141 | display: flex; 142 | justify-content: center; 143 | } 144 | 145 | .searchTerm { 146 | width: 50%; 147 | /* border: 3px solid #00b4cc; */ 148 | border: none; 149 | padding: 16px; 150 | height: 20px; 151 | border-radius: 5px 0 0 5px; 152 | outline: none; 153 | font-size: 18px; 154 | } 155 | 156 | .searchTerm:focus { 157 | color: #00b4cc; 158 | } 159 | 160 | .searchButton { 161 | width: 80px; 162 | height: 32px; 163 | border: none; 164 | background: #048b9c; 165 | text-align: center; 166 | color: #fff; 167 | border-radius: 0 5px 5px 0; 168 | cursor: pointer; 169 | font-size: 20px; 170 | outline: none; 171 | font-size: 16px; 172 | } 173 | 174 | .searchButton:hover { 175 | background-color: #17b8ce; 176 | } 177 | 178 | .wrap { 179 | display: flex; 180 | justify-content: center; 181 | text-align: center; 182 | margin-top: -150px; 183 | margin-bottom: 50px; 184 | } 185 | 186 | /*Resize the wrap to see the search bar change!*/ 187 | /* .wrap { 188 | width: 30%; 189 | position: absolute; 190 | top: 50%; 191 | left: 50%; 192 | transform: translate(-50%, -50%); 193 | } */ 194 | -------------------------------------------------------------------------------- /src/components/weather/temp.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from "react"; 2 | import Weathercard from "./weathercard"; 3 | import "./style.css"; 4 | 5 | const Temp = () => { 6 | const [searchValue, setSearchValue] = useState("pune"); 7 | const [tempInfo, setTempInfo] = useState({}); 8 | 9 | const getWeatherInfo = async () => { 10 | try { 11 | let url = `https://api.openweathermap.org/data/2.5/weather?q=${searchValue}&units=metric&appid={WriteYourAPIKey}`; 12 | 13 | let res = await fetch(url); 14 | let data = await res.json(); 15 | 16 | const { temp, humidity, pressure } = data.main; 17 | const { main: weathermood } = data.weather[0]; 18 | const { name } = data; 19 | const { speed } = data.wind; 20 | const { country, sunset } = data.sys; 21 | 22 | const myNewWeatherInfo = { 23 | temp, 24 | humidity, 25 | pressure, 26 | weathermood, 27 | name, 28 | speed, 29 | country, 30 | sunset, 31 | }; 32 | 33 | setTempInfo(myNewWeatherInfo); 34 | } catch (error) { 35 | console.log(error); 36 | } 37 | }; 38 | 39 | useEffect(() => { 40 | getWeatherInfo(); 41 | }, []); 42 | 43 | return ( 44 | <> 45 |
46 |
47 | setSearchValue(e.target.value)} 55 | /> 56 | 57 | 63 |
64 |
65 | 66 | {/* our temp card */} 67 | 68 | 69 | ); 70 | }; 71 | 72 | export default Temp; 73 | -------------------------------------------------------------------------------- /src/components/weather/weathercard.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from "react"; 2 | 3 | const Weathercard = ({ 4 | temp, 5 | humidity, 6 | pressure, 7 | weathermood, 8 | name, 9 | speed, 10 | country, 11 | sunset, 12 | }) => { 13 | const [weatherState, setWeatheState] = React.useState(""); 14 | 15 | useEffect(() => { 16 | if (weathermood) { 17 | switch (weathermood) { 18 | case "Clouds": 19 | setWeatheState("wi-day-cloudy"); 20 | break; 21 | case "Haze": 22 | setWeatheState("wi-fog"); 23 | break; 24 | case "Clear": 25 | setWeatheState("wi-day-sunny"); 26 | break; 27 | case "Mist": 28 | setWeatheState("wi-dust"); 29 | break; 30 | 31 | default: 32 | setWeatheState("wi-day-sunny"); 33 | break; 34 | } 35 | } 36 | }, [weathermood]); 37 | 38 | // converting the seconds into time 39 | let sec = sunset; 40 | let date = new Date(sec * 1000); 41 | let timeStr = `${date.getHours()}:${date.getMinutes()}`; 42 | return ( 43 | <> 44 |
45 |
46 | 47 |
48 | 49 |
50 |
51 | {temp}° 52 |
53 | 54 |
55 |
{weathermood}
56 |
57 | {name}, {country} 58 |
59 |
60 |
61 | 62 |
{new Date().toLocaleString()}
63 | 64 | {/* our 4column section */} 65 |
66 |
67 |
68 |

69 | 70 |

71 |

72 | {timeStr} PM
73 | Sunset 74 |

75 |
76 | 77 |
78 |

79 | 80 |

81 |

82 | {humidity}
83 | Humidity 84 |

85 |
86 |
87 | 88 |
89 |
90 |

91 | 92 |

93 |

94 | {pressure}
95 | Pressure 96 |

97 |
98 | 99 |
100 |

101 | 102 |

103 |

104 | {speed}
105 | Speed 106 |

107 |
108 |
109 |
110 |
111 | 112 | ); 113 | }; 114 | 115 | export default Weathercard; 116 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------