Skip to content

Commit 0bbaf6c

Browse files
authored
docs(examples): update react examples (#1260)
* docs(examples): update react examples - react instantsearch hooks -> react instantsearch (changed dependency, used react 18) - react 18 -> react - react -> react 17 * update ignore * fix urls
1 parent d0b3b27 commit 0bbaf6c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+133
-698
lines changed

.eslintignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ dist
66
node_modules
77
examples/twitter-compose-with-typeahead
88
examples/slack-with-emojis-and-commands
9-
examples/react-instantsearch-hooks
9+
examples/react-instantsearch
1010
examples/vue-instantsearch
11-
examples/react-18
11+
examples/react

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ dist/
1515

1616
# Environment files
1717
.env
18+
19+
!examples/*/.env
File renamed without changes.

examples/react-17/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SKIP_PREFLIGHT_CHECK=true
File renamed without changes.
File renamed without changes.

examples/react-renderer/package.json renamed to examples/react-17/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "@algolia/autocomplete-example-react-renderer",
3-
"description": "Autocomplete example with React Renderer",
2+
"name": "@algolia/autocomplete-example-react-17",
3+
"description": "Autocomplete example with React 17",
44
"version": "1.17.2",
55
"private": true,
66
"dependencies": {

examples/react-renderer/public/index.html renamed to examples/react-17/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
99
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
1010

11-
<title>React Renderer | Autocomplete</title>
11+
<title>React 17 | Autocomplete</title>
1212
</head>
1313
<body>
1414
<noscript>You need to enable JavaScript to run this app.</noscript>
File renamed without changes.
File renamed without changes.

examples/react-instantsearch-hooks/README.md

Lines changed: 0 additions & 34 deletions
This file was deleted.
-686 KB
Binary file not shown.

examples/react-instantsearch-hooks/index.html

Lines changed: 0 additions & 22 deletions
This file was deleted.

examples/react-instantsearch-hooks/package.json

Lines changed: 0 additions & 34 deletions
This file was deleted.

examples/react-instantsearch-hooks/src/App.css

Lines changed: 0 additions & 113 deletions
This file was deleted.

examples/react-instantsearch-hooks/src/main.tsx

Lines changed: 0 additions & 11 deletions
This file was deleted.

examples/react-instantsearch/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ git clone [email protected]:algolia/autocomplete.git
2020

2121
```sh
2222
yarn
23-
yarn workspace @algolia/autocomplete-example-react-instantsearch start
23+
yarn workspace @algolia/autocomplete-example-react-instantsearch-hooks dev
2424
```
2525

2626
Alternatively, you may use npm:
2727

2828
```sh
29-
cd examples/react-instantsearch
29+
cd examples/react-instantsearch-hooks
3030
npm install
31-
npm start
31+
npm run dev
3232
```
3333

34-
Open <http://localhost:1234> to see your app.
34+
Open <http://localhost:3000> to see your app.
Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
<!DOCTYPE html>
22
<html lang="en">
33
<head>
4-
<meta charset="utf-8" />
5-
<meta
6-
name="viewport"
7-
content="width=device-width, initial-scale=1, shrink-to-fit=no"
8-
/>
9-
<meta name="theme-color" content="#000000" />
10-
11-
<link rel="shortcut icon" href="favicon.png" />
4+
<meta charset="UTF-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<link rel="shortcut icon" type="image/x-icon" href="/src/favicon.png" />
8+
<title>React InstantSearch | Autocomplete</title>
9+
<!--
10+
Do not use @7 in production, use a complete version like x.x.x, see website for latest version:
11+
https://www.algolia.com/doc/guides/building-search-ui/installation/react/#load-the-style
12+
-->
1213
<link
1314
rel="stylesheet"
1415
href="https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/satellite-min.css"
1516
/>
16-
17-
<title>Autocomplete with React InstantSearch</title>
1817
</head>
19-
2018
<body>
21-
<noscript> You need to enable JavaScript to run this app. </noscript>
22-
2319
<div id="root"></div>
24-
25-
<script type="module" src="./src/index.js"></script>
20+
<script type="module" src="/src/main.tsx"></script>
2621
</body>
2722
</html>

examples/react-instantsearch/package.json

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,30 @@
55
"private": true,
66
"license": "MIT",
77
"scripts": {
8-
"build": "parcel build index.html",
9-
"start": "parcel index.html"
8+
"dev": "vite",
9+
"build": "tsc && vite build",
10+
"preview": "vite preview"
1011
},
1112
"dependencies": {
1213
"@algolia/autocomplete-js": "1.17.2",
1314
"@algolia/autocomplete-plugin-query-suggestions": "1.17.2",
1415
"@algolia/autocomplete-plugin-recent-searches": "1.17.2",
1516
"@algolia/autocomplete-theme-classic": "1.17.2",
1617
"algoliasearch": "4.16.0",
17-
"qs": "6.11.1",
18-
"react": "17.0.2",
19-
"react-dom": "17.0.2",
20-
"react-instantsearch-dom": "6.39.1"
18+
"react": "^18.2.0",
19+
"react-dom": "^18.2.0",
20+
"react-instantsearch": "7.11.3"
2121
},
2222
"devDependencies": {
23-
"@babel/core": "7.21.4",
24-
"parcel": "2.8.3"
25-
}
23+
"@types/react": "^18.0.26",
24+
"@types/react-dom": "^18.0.9",
25+
"@vitejs/plugin-react": "1.0.7",
26+
"typescript": "4.5.4",
27+
"vite": "2.8.0"
28+
},
29+
"keywords": [
30+
"algolia",
31+
"autocomplete",
32+
"react"
33+
]
2634
}

0 commit comments

Comments
 (0)