Skip to content

Commit dbbda0f

Browse files
samoussHaroenv
authored andcommitted
feat(index): add widget
* feat(index): add widget [PART-1] (#3892) * feat(index): use widget [PART-2] (#3893) * feat(index): add story [PART-3] (#3914)
1 parent 55d44eb commit dbbda0f

18 files changed

+2160
-1166
lines changed

.storybook/playgrounds/default.ts

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
import instantsearch from '../../src/index';
22

3+
export const hitsItemTemplate = `
4+
<div
5+
class="hits-image"
6+
style="background-image: url({{image}})"
7+
></div>
8+
<article>
9+
<header>
10+
<strong>{{#helpers.highlight}}{ "attribute": "name" }{{/helpers.highlight}}</strong>
11+
</header>
12+
<p>
13+
{{#helpers.snippet}}{ "attribute": "description" }{{/helpers.snippet}}
14+
</p>
15+
<footer>
16+
<p>
17+
<strong>{{price}}$</strong>
18+
</p>
19+
</footer>
20+
</article>
21+
`;
22+
323
function instantSearchPlayground({
424
search,
525
leftPanel,
@@ -93,25 +113,7 @@ function instantSearchPlayground({
93113
instantsearch.widgets.hits({
94114
container: hits,
95115
templates: {
96-
item: `
97-
<div
98-
class="hits-image"
99-
style="background-image: url({{image}})"
100-
></div>
101-
<article>
102-
<header>
103-
<strong>{{#helpers.highlight}}{ "attribute": "name" }{{/helpers.highlight}}</strong>
104-
</header>
105-
<p>
106-
{{#helpers.snippet}}{ "attribute": "description" }{{/helpers.snippet}}
107-
</p>
108-
<footer>
109-
<p>
110-
<strong>{{price}}$</strong>
111-
</p>
112-
</footer>
113-
</article>
114-
`,
116+
item: hitsItemTemplate,
115117
},
116118
cssClasses: {
117119
item: 'hits-item',

0 commit comments

Comments
 (0)