-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add a reload method on the InstantSearch component (#2637)
- Loading branch information
1 parent
71c2d68
commit e73ff13
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* eslint-disable import/default */ | ||
|
||
import { storiesOf } from 'dev-novel'; | ||
import instantsearch from '../../../../index'; | ||
import { wrapWithHits } from '../../utils/wrap-with-hits.js'; | ||
|
||
const stories = storiesOf('Reload'); | ||
|
||
export default () => { | ||
stories.add( | ||
'default', | ||
wrapWithHits(container => { | ||
const button = document.createElement('button'); | ||
button.addEventListener('click', () => window.search.reload()); | ||
button.innerHTML = 'Reload InstantSearch'; | ||
const searchBoxContainer = document.createElement('div'); | ||
window.search.addWidget( | ||
instantsearch.widgets.searchBox({ container: searchBoxContainer }) | ||
); | ||
container.appendChild(button); | ||
container.appendChild(searchBoxContainer); | ||
}) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters