Skip to content

Commit bbcc8e2

Browse files
author
Vishal Upadhyay
committed
user input and event
1 parent 0f5acf3 commit bbcc8e2

14 files changed

+16585
-0
lines changed

4_user_input_and_event/.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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*

4_user_input_and_event/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# User input and Event Handling
2+
3+
## Events
4+
![event](../images/18_events.png)

4_user_input_and_event/package-lock.json

+16,410
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

4_user_input_and_event/package.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "4_user_input_and_event",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"@testing-library/jest-dom": "^5.14.1",
7+
"@testing-library/react": "^11.2.7",
8+
"@testing-library/user-event": "^12.8.3",
9+
"react": "^17.0.2",
10+
"react-dom": "^17.0.2",
11+
"react-scripts": "4.0.3",
12+
"web-vitals": "^1.1.2"
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+
}
3.78 KB
Binary file not shown.
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<meta name="theme-color" content="#000000" />
9+
<meta
10+
name="description"
11+
content="Web site created using create-react-app"
12+
/>
13+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
14+
<!--
15+
manifest.json provides metadata used when your web app is installed on a
16+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
17+
-->
18+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
19+
<!--
20+
Notice the use of %PUBLIC_URL% in the tags above.
21+
It will be replaced with the URL of the `public` folder during the build.
22+
Only files inside the `public` folder can be referenced from the HTML.
23+
24+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
25+
work correctly both with client-side routing and a non-root public URL.
26+
Learn how to configure a non-root public URL by running `npm run build`.
27+
-->
28+
<title>React App</title>
29+
</head>
30+
<body>
31+
<noscript>You need to enable JavaScript to run this app.</noscript>
32+
<div id="root"></div>
33+
<!--
34+
This HTML file is a template.
35+
If you open it directly in the browser, you will see an empty page.
36+
37+
You can add webfonts, meta tags, or analytics to this file.
38+
The build step will place the bundled scripts into the <body> tag.
39+
40+
To begin the development, run `npm start` or `yarn start`.
41+
To create a production bundle, use `npm run build` or `yarn build`.
42+
-->
43+
</body>
44+
</html>
5.22 KB
Loading
9.44 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://www.robotstxt.org/robotstxt.html
2+
User-agent: *
3+
Disallow:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react";
2+
import SearchBar from "./SearchBar";
3+
4+
const App = () => {
5+
return (
6+
<div className="ui container" style={{ marginTop: '10px' }}>
7+
<SearchBar />
8+
</div>
9+
)
10+
}
11+
12+
export default App;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from "react";
2+
3+
class SearchBar extends React.Component {
4+
5+
state = {term: ''};
6+
7+
render() {
8+
return (
9+
<div className="ui segment">
10+
<form className="ui form">
11+
<div className="field">
12+
<label>Image Search</label>
13+
<input type="text" value={this.state.term} onChange={e => this.setState({ term: e.target.value})} />
14+
</div>
15+
</form>
16+
</div>
17+
)
18+
}
19+
}
20+
21+
export default SearchBar;

4_user_input_and_event/src/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import App from './components/App';
4+
5+
ReactDOM.render(<App />, document.querySelector('#root'))

images/18_events.png

133 KB
Loading

0 commit comments

Comments
 (0)