Skip to content

Commit

Permalink
feat(instantsearch): better hiding
Browse files Browse the repository at this point in the history
Now also hides the pagination block matching the CSS selector
in options.instantsearch.paginationSelector
  • Loading branch information
Jerska committed Feb 15, 2016
1 parent 02609ab commit c668c28
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
1 change: 1 addition & 0 deletions app/css/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* Search by */
.ais-search-box--powered-by-link, .aa-powered-by-link {
display: inline-block;
width: 45px;
Expand Down
2 changes: 2 additions & 0 deletions app/src/AlgoliasearchZendeskHC.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const optionsStructure = {required: true, type: 'Object', children: {
indexPrefix: {type: 'string', value: 'zendesk_'},
instantsearch: {type: 'Object', value: {}, children: {
enabled: {type: 'boolean', value: true},
paginationSelector: {type: 'string', value: '.pagination'},
selector: {type: 'string', value: '.search-results'},
tagsLimit: {type: 'number', value: 15}
}},
Expand All @@ -44,6 +45,7 @@ class AlgoliasearchZendeskHC {
const genericHiding = addCSS(`
${options.autocomplete.inputSelector} { display: none; }
${options.instantsearch.selector} { display: none; }
${options.instantsearch.paginationSelector} { display: none; }
`);

// once the DOM is initialized
Expand Down
10 changes: 0 additions & 10 deletions app/src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
import addCSS from './addCSS.js';
import toFactory from 'to-factory';
import AlgoliasearchZendeskHC from './AlgoliasearchZendeskHC.js';

addCSS(`
.search-results h1:first-child {
display: none !important;
}
.search-results-column {
display: none;
visibility: hidden;
}`);

export default toFactory(AlgoliasearchZendeskHC);
3 changes: 3 additions & 0 deletions app/src/instantsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export default (options) => {
}
$elt.hide();

let $paginationContainer = $(options.instantsearch.paginationSelector);
$paginationContainer.hide();

let search = instantsearch({
appId: options.applicationId,
apiKey: options.apiKey,
Expand Down

0 comments on commit c668c28

Please sign in to comment.