Skip to content

Commit

Permalink
feat(index): add widget
Browse files Browse the repository at this point in the history
* feat(index): add widget [PART-1] (#3892)

* feat(index): use widget [PART-2] (#3893)

* feat(index): add story [PART-3] (#3914)
  • Loading branch information
samouss authored and Haroenv committed Oct 23, 2019
1 parent 55d44eb commit dbbda0f
Show file tree
Hide file tree
Showing 18 changed files with 2,160 additions and 1,166 deletions.
40 changes: 21 additions & 19 deletions .storybook/playgrounds/default.ts
@@ -1,5 +1,25 @@
import instantsearch from '../../src/index';

export const hitsItemTemplate = `
<div
class="hits-image"
style="background-image: url({{image}})"
></div>
<article>
<header>
<strong>{{#helpers.highlight}}{ "attribute": "name" }{{/helpers.highlight}}</strong>
</header>
<p>
{{#helpers.snippet}}{ "attribute": "description" }{{/helpers.snippet}}
</p>
<footer>
<p>
<strong>{{price}}$</strong>
</p>
</footer>
</article>
`;

function instantSearchPlayground({
search,
leftPanel,
Expand Down Expand Up @@ -93,25 +113,7 @@ function instantSearchPlayground({
instantsearch.widgets.hits({
container: hits,
templates: {
item: `
<div
class="hits-image"
style="background-image: url({{image}})"
></div>
<article>
<header>
<strong>{{#helpers.highlight}}{ "attribute": "name" }{{/helpers.highlight}}</strong>
</header>
<p>
{{#helpers.snippet}}{ "attribute": "description" }{{/helpers.snippet}}
</p>
<footer>
<p>
<strong>{{price}}$</strong>
</p>
</footer>
</article>
`,
item: hitsItemTemplate,
},
cssClasses: {
item: 'hits-item',
Expand Down

0 comments on commit dbbda0f

Please sign in to comment.