Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit fc969a8

Browse files
fan wiki search (#77)
1 parent 0dff8ee commit fc969a8

File tree

16 files changed

+12229
-12
lines changed

16 files changed

+12229
-12
lines changed

fan-wiki-react-web-app-project/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![under_construction](https://user-images.githubusercontent.com/37651620/93677983-a7942e00-facc-11ea-8b6d-b57e73dc73bf.png)
1+
# Getting Started with Create React App
22

33
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
44

@@ -8,23 +8,23 @@ In the project directory, you can run:
88

99
### `yarn start`
1010

11-
Runs the app in the development mode.<br />
11+
Runs the app in the development mode.\
1212
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
1313

14-
The page will reload if you make edits.<br />
14+
The page will reload if you make edits.\
1515
You will also see any lint errors in the console.
1616

1717
### `yarn test`
1818

19-
Launches the test runner in the interactive watch mode.<br />
19+
Launches the test runner in the interactive watch mode.\
2020
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
2121

2222
### `yarn build`
2323

24-
Builds the app for production to the `build` folder.<br />
24+
Builds the app for production to the `build` folder.\
2525
It correctly bundles React in production mode and optimizes the build for the best performance.
2626

27-
The build is minified and the filenames include the hashes.<br />
27+
The build is minified and the filenames include the hashes.\
2828
Your app is ready to be deployed!
2929

3030
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
@@ -47,24 +47,24 @@ To learn React, check out the [React documentation](https://reactjs.org/).
4747

4848
### Code Splitting
4949

50-
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
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)
5151

5252
### Analyzing the Bundle Size
5353

54-
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
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)
5555

5656
### Making a Progressive Web App
5757

58-
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
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)
5959

6060
### Advanced Configuration
6161

62-
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
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)
6363

6464
### Deployment
6565

66-
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
66+
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
6767

6868
### `yarn build` fails to minify
6969

70-
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
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)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "fan-wiki-react-web-app-project",
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.1",
10+
"react-dom": "^17.0.1",
11+
"react-scripts": "4.0.1",
12+
"web-vitals": "^0.2.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+
}
Binary file not shown.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13+
14+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
15+
16+
<title>Wiki Search</title>
17+
</head>
18+
<body>
19+
<noscript>You need to enable JavaScript to run this app.</noscript>
20+
<div id="root"></div>
21+
22+
</body>
23+
</html>
Loading
Loading
Lines changed: 25 additions & 0 deletions
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+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://www.robotstxt.org/robotstxt.html
2+
User-agent: *
3+
Disallow:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React,{useState} from 'react';
2+
import WikiSearchResults from "./components/WikiSearchResults";
3+
import "./styles/App.css";
4+
5+
function App() {
6+
const [wikiSearch,setWikiSearch] = useState("");
7+
const [searchName,setSearchName] = useState([]);
8+
const [searchLinks,setSearchLinks] = useState([]);
9+
10+
async function btnSearch(){
11+
const url = `https://en.wikipedia.org/w/api.php?action=opensearch&search=${wikiSearch}&format=json&origin=*`;
12+
const response = await fetch(url);
13+
const jsonResponse = await response.json();
14+
// console.log(JSON.stringify(jsonResponse, null , 3));
15+
// console.log(jsonResponse);
16+
setSearchName(jsonResponse[1]);
17+
setSearchLinks(jsonResponse[3]);
18+
}
19+
20+
return (
21+
<div className="App">
22+
<div className="wrapper">
23+
<div className="searchBo">
24+
<h1 className="ws-search">Fan Wiki Search</h1>
25+
<input className="searchBox" value={wikiSearch} onChange={e => setWikiSearch(e.target.value)} placeholder="Search anything...." />
26+
<button className="btn draw-border" onClick={btnSearch}>Search</button>
27+
{searchName.map((value, i) => <WikiSearchResults name={value} link={searchLinks[i]} key={i + value} />)}
28+
</div>
29+
</div>
30+
</div>
31+
)
32+
}
33+
34+
export default App
Binary file not shown.

0 commit comments

Comments
 (0)