Skip to content

Commit

Permalink
fix: allow adding css classes to the searchBox wrapper
Browse files Browse the repository at this point in the history
fixes #22
fixes #24
  • Loading branch information
vvo committed Aug 3, 2015
1 parent 3cc8cc6 commit 6ef0b0b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
25 changes: 15 additions & 10 deletions example/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@ var instant = new instantsearch.InstantSearch(
'bestbuy'
);

instant.addWidget(instantsearch.widgets.searchbox({
container: '#search-box',
placeholder: 'Search for products in France...'
}));
instant.addWidget(
instantsearch.widgets.searchbox({
container: '#search-box',
placeholder: 'Search for products',
addClass: 'form-control'
})
);

instant.addWidget(instantsearch.widgets.results({
instant.addWidget(
instantsearch.widgets.results({
container: '#hits',
templates: {
noResults: require('./templates/no-results.html'),
hit: require('./templates/hit.html')
}
}));
templates: {
noResults: require('./templates/no-results.html'),
hit: require('./templates/hit.html')
}
})
);

instant.start();
13 changes: 9 additions & 4 deletions widgets/searchbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ var React = require('react');

var utils = require('../../lib/widgetUtils');

function searchbox(parameters) {
function searchbox(params) {
var SearchBox = require('../../components/SearchBox');
var container = utils.getContainerNode(parameters.container);
var container = utils.getContainerNode(params.container);

return {
init: function(initialState, helper) {
React.render(<SearchBox helper={helper}
placeholder={parameters.placeholder} />, container);
React.render(
<SearchBox
helper={helper}
placeholder={params.placeholder}
inputClass={params.addClass} />, container
);
}
};
}
Expand Down

0 comments on commit 6ef0b0b

Please sign in to comment.