Skip to content

Commit 210d202

Browse files
committed
Reactivesearch initialize
1 parent ea37d24 commit 210d202

File tree

7 files changed

+224
-0
lines changed

7 files changed

+224
-0
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015", "react"]
3+
}

app/index.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import React, { Component } from 'react';
2+
import ReactDom from 'react-dom';
3+
import {
4+
ReactiveBase,
5+
RatingsFilter,
6+
ResultCard
7+
} from '@appbaseio/reactivesearch';
8+
9+
class HelloWorld extends Component {
10+
11+
onData(res) {
12+
const result = {
13+
image: "https://www.enterprise.com/content/dam/global-vehicle-images/cars/FORD_FOCU_2012-1.png",
14+
title: res.name,
15+
rating: res.rating,
16+
desc: res.brand,
17+
url: "#"
18+
};
19+
return result;
20+
}
21+
22+
render() {
23+
return (
24+
<ReactiveBase
25+
app="car-store"
26+
credentials="cf7QByt5e:d2d60548-82a9-43cc-8b40-93cbbe75c34c"
27+
>
28+
<div className="row reverse-labels">
29+
<div className="col s6 col-xs-6">
30+
<ResultCard
31+
componentId="SearchResult"
32+
appbaseField="name"
33+
title="Results"
34+
from={0}
35+
size={20}
36+
onData={this.onData}
37+
sortOptions={[
38+
{
39+
label: "Lowest Price First",
40+
appbaseField: "price",
41+
sortBy: "asc"
42+
},
43+
{
44+
label: "Highest Price First",
45+
appbaseField: "price",
46+
sortBy: "desc"
47+
},
48+
{
49+
label: "Most rated",
50+
appbaseField: "rating",
51+
sortBy: "desc"
52+
}
53+
]}
54+
react={{
55+
and: "RatingsSensor"
56+
}}
57+
/>
58+
</div>
59+
<div className="col s6 col-xs-6">
60+
<RatingsFilter
61+
componentId="RatingsSensor"
62+
appbaseField="rating"
63+
title="RatingsFilter"
64+
data={
65+
[{ start: 4, end: 5, label: "4 stars and up" },
66+
{ start: 3, end: 5, label: "3 stars and up" },
67+
{ start: 2, end: 5, label: "2 stars and up" },
68+
{ start: 1, end: 5, label: "> 1 stars" }]
69+
}
70+
/>
71+
</div>
72+
</div>
73+
</ReactiveBase>
74+
);
75+
}
76+
}
77+
78+
ReactDom.render(<HelloWorld />, document.getElementById('app'));

dist/bundle.js

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bundle.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<title>Reactive Maps Example Application</title>
7+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/css/materialize.min.css">
8+
<link rel="stylesheet" href="node_modules/@appbaseio/reactivesearch/dist/css/style.min.css">
9+
<script type="text/javascript" src="https://maps.google.com/maps/api/js?key=AIzaSyC-v0oz7Pay_ltypZbKasABXGiY9NlpCIY&libraries=places"></script>
10+
</head>
11+
<body>
12+
<div id="app"></div>
13+
<script src="dist/bundle.js"></script>
14+
</body>
15+
</html>

package.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "reactivesearch-starter-app",
3+
"version": "1.0.0",
4+
"description": "reactivesearch",
5+
"main": "index.js",
6+
"scripts": {
7+
"webpack-dev-server": "webpack-dev-server --inline --hot --port 8000",
8+
"dev": "webpack -d --watch",
9+
"start": "npm-run-all --parallel dev webpack-dev-server",
10+
"build": "webpack -p"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://github.com/appbaseio-apps/reactivesearch-starter-app.git"
15+
},
16+
"license": "MIT",
17+
"bugs": {
18+
"url": "https://github.com/appbaseio-apps/reactivesearch-starter-app/issues"
19+
},
20+
"homepage": "https://github.com/appbaseio-apps/reactivesearch-starter-app#readme",
21+
"author": {
22+
"name": "Farhan Chaunan (appbase.io)",
23+
"email": "[email protected]",
24+
"url": "https://github.com/farhan687"
25+
},
26+
"devDependencies": {
27+
"babel-core": "^6.24.0",
28+
"babel-loader": "^6.4.1",
29+
"babel-preset-es2015": "^6.24.0",
30+
"babel-preset-react": "^6.23.0",
31+
"html-webpack-plugin": "^2.24.1",
32+
"npm-run-all": "^4.0.2",
33+
"shebang-loader": "0.0.1",
34+
"webpack": "^2.3.3",
35+
"webpack-dev-server": "^2.4.2"
36+
},
37+
"dependencies": {
38+
"@appbaseio/reactivesearch": "^0.4.0",
39+
"react": "^15.4.1",
40+
"react-dom": "^15.4.1",
41+
"webpack-dev-server": "^2.4.2"
42+
}
43+
}

webpack.config.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const path = require("path");
2+
3+
module.exports = {
4+
context: path.resolve(__dirname, "./app"),
5+
entry: "./index.js",
6+
output: {
7+
path: path.resolve(__dirname, "./dist"),
8+
filename: "bundle.js",
9+
publicPath: "/dist/"
10+
},
11+
module: {
12+
rules: [
13+
{
14+
test: /\.js$/,
15+
exclude: /node_modules/,
16+
use: ["babel-loader"]
17+
},
18+
{
19+
test: /node_modules\/JSONStream\/index\.js$/,
20+
use: ["shebang-loader", "babel-loader"]
21+
}
22+
]
23+
},
24+
externals: ["ws"]
25+
}

0 commit comments

Comments
 (0)