Skip to content

Commit ea666ad

Browse files
author
vvo
committed
feat: pimp the npm run dev example using instant search data
fixes #20
1 parent 32c64e6 commit ea666ad

File tree

6 files changed

+52
-8
lines changed

6 files changed

+52
-8
lines changed

example/app.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
require('./style.css');
2+
13
var instantsearch = require('../');
24

35
var instant = new instantsearch.InstantSearch(
4-
'JTH1JDTDFT',
5-
'34a4c1b994546fbec45a670a06ba0c33',
6-
'Bibliotheques'
6+
'latency',
7+
'6be0576ff61c053d5f9a3225e2a90f76',
8+
'bestbuy'
79
);
810

911
instant.addWidget(instantsearch.widgets.searchbox({
1012
container: '#search-box',
11-
placeholder: 'Search for libraries in France...'
13+
placeholder: 'Search for products in France...'
1214
}));
1315

1416
instant.addWidget(instantsearch.widgets.results({

example/index.html

+18-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,26 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>Instant search example</title>
5+
<title>Instant search demo built with instantsearch.js</title>
6+
<link rel="stylesheet" href="//cdn.jsdelivr.net/bootstrap/3.3.5/css/bootstrap.min.css">
7+
<link rel="stylesheet" href="//cdn.jsdelivr.net/bootstrap/3.3.5/css/bootstrap-theme.min.css">
68
</head>
79
<body>
8-
<div id="search-box"></div>
9-
<div id="hits"></div>
10+
<div class="container">
11+
<div class="page-header">
12+
<h1>Instant search demo <small>using instantsearch.js</small></h1>
13+
</div>
14+
15+
<div class="row">
16+
<div class="col-md-3">
17+
18+
<div id="search-box"></div>
19+
</div>
20+
<div class="col-md-9">
21+
<div id="hits"></div>
22+
</div>
23+
</div>
24+
</div>
1025

1126
<script src="bundle.js"></script>
1227
</body>

example/style.css

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
body {
2+
padding: 2em 0;
3+
}
4+
5+
.hit + .hit {
6+
margin-top: 1em;
7+
padding-top: 1em;
8+
border-top: 1px solid #bbb;
9+
}
10+
11+
.hit em {
12+
font-style: normal;
13+
background-color: lightcyan;
14+
}

example/templates/hit.html

+10-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
<div>{{libelle1}}</div>
1+
<div class="media">
2+
<a class="pull-left" href="{{url}}">
3+
<img class="media-object" src="{{image}}">
4+
</a>
5+
<div class="media-body">
6+
<h3 class="pull-right text-right text-info">${{salePrice}}</h3>
7+
<h4>{{{_highlightResult.name.value}}}</h4>
8+
<p>{{{_highlightResult.shortDescription.value}}}</p>
9+
</div>
10+
</div>

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"babel": "5.8.19",
2828
"babel-eslint": "4.0.5",
2929
"babel-loader": "5.3.2",
30+
"css-loader": "0.15.6",
3031
"eslint": "0.24.1",
3132
"eslint-config-airbnb": "0.0.7",
3233
"eslint-config-algolia": "2.1.2",
@@ -40,6 +41,7 @@
4041
"sinon": "1.15.4",
4142
"tap-spec": "4.0.2",
4243
"tape": "4.0.1",
44+
"style-loader": "0.12.3",
4345
"uglifyjs": "2.4.10",
4446
"webpack": "1.10.5",
4547
"webpack-dev-server": "1.10.1"

webpack.example.config.js

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ module.exports = {
1010
test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'
1111
}, {
1212
test: /\.html$/, exclude: /node_modules/, loader: 'raw'
13+
}, {
14+
test: /\.css$/, loader: 'style-loader!css-loader'
1315
}]
1416
},
1517
devServer: {

0 commit comments

Comments
 (0)