Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 51 additions & 22 deletions e2e/__snapshots__/templates.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,15 @@ exports[`Templates Angular InstantSearch File content: src/app/app.component.htm

<div class=\\"container\\">
<ais-instantsearch [config]=\\"config\\">
<ais-configure [searchParameters]=\\"{ hitsPerPage: 8 }\\"></ais-configure>
<div class=\\"search-panel\\">
<div class=\\"search-panel__filters\\">
<ais-refinement-list attribute=\\"facet1\\"></ais-refinement-list>
<ais-refinement-list attribute=\\"facet2\\"></ais-refinement-list>
<ais-panel header=\\"facet1\\">
<ais-refinement-list attribute=\\"facet1\\"></ais-refinement-list>
</ais-panel>
<ais-panel header=\\"facet2\\">
<ais-refinement-list attribute=\\"facet2\\"></ais-refinement-list>
</ais-panel>
</div>

<div class=\\"search-panel__results\\">
Expand Down Expand Up @@ -3084,7 +3089,7 @@ exports[`Templates InstantSearch.js File content: index.html 1`] = `

<link rel=\\"shortcut icon\\" href=\\"./favicon.png\\">

<link rel=\\"stylesheet\\" href=\\"https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/algolia-min.css\\">
<link rel=\\"stylesheet\\" href=\\"https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/satellite-min.css\\">
<link rel=\\"stylesheet\\" href=\\"./src/index.css\\">
<link rel=\\"stylesheet\\" href=\\"./src/app.css\\">

Expand Down Expand Up @@ -3113,10 +3118,9 @@ exports[`Templates InstantSearch.js File content: index.html 1`] = `
<div class=\\"search-panel__results\\">
<div id=\\"searchbox\\"></div>
<div id=\\"hits\\"></div>
<div id=\\"pagination\\"></div>
</div>
</div>

<div id=\\"pagination\\"></div>
</div>

<script src=\\"https://cdn.jsdelivr.net/npm/algoliasearch@4.10.5/dist/algoliasearch-lite.umd.js\\"></script>
Expand Down Expand Up @@ -3234,25 +3238,30 @@ search.addWidgets([
},
}),
instantsearch.widgets.configure({
facets: ['*'],
maxValuesPerFacet: 20,
hitsPerPage: 8,
}),
instantsearch.widgets.dynamicWidgets({
container: '#dynamic-widgets',
fallbackWidget({ container, attribute }) {
return instantsearch.widgets.refinementList({
return instantsearch.widgets.panel({ templates: { header: attribute } })(
instantsearch.widgets.refinementList
)({
container,
attribute,
});
},
widgets: [
container =>
instantsearch.widgets.refinementList({
instantsearch.widgets.panel({
templates: { header: 'facet1' },
})(instantsearch.widgets.refinementList)({
container,
attribute: 'facet1',
}),
container =>
instantsearch.widgets.refinementList({
instantsearch.widgets.panel({
templates: { header: 'facet2' },
})(instantsearch.widgets.refinementList)({
container,
attribute: 'facet2',
}),
Expand Down Expand Up @@ -5611,7 +5620,7 @@ exports[`Templates React InstantSearch File content: public/index.html 1`] = `
Do not use @7 in production, use a complete version like x.x.x, see website for latest version:
https://www.algolia.com/doc/guides/building-search-ui/installation/react/#load-the-style
-->
<link rel=\\"stylesheet\\" href=\\"https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/algolia-min.css\\">
<link rel=\\"stylesheet\\" href=\\"https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/satellite-min.css\\">

<title>react-instantsearch-app</title>
</head>
Expand Down Expand Up @@ -5713,10 +5722,11 @@ exports[`Templates React InstantSearch File content: src/App.js 1`] = `
import algoliasearch from 'algoliasearch/lite';
import {
InstantSearch,
Configure,
Hits,
SearchBox,
Configure,
DynamicWidgets,
Panel,
RefinementList,
Pagination,
Highlight,
Expand All @@ -5743,12 +5753,16 @@ function App() {

<div className=\\"container\\">
<InstantSearch searchClient={searchClient} indexName=\\"indexName\\">
<Configure hitsPerPage={8} />
<div className=\\"search-panel\\">
<div className=\\"search-panel__filters\\">
<Configure facets={['*']} maxValuesPerFacet={20} />
<DynamicWidgets fallbackWidget={RefinementList}>
<RefinementList attribute=\\"facet1\\" />
<RefinementList attribute=\\"facet2\\" />
<Panel header=\\"facet1\\">
<RefinementList attribute=\\"facet1\\" />
</Panel>
<Panel header=\\"facet2\\">
<RefinementList attribute=\\"facet2\\" />
</Panel>
</DynamicWidgets>
</div>

Expand Down Expand Up @@ -6025,6 +6039,7 @@ em {
exports[`Templates React InstantSearch Hooks File content: src/App.tsx 1`] = `
"import algoliasearch from 'algoliasearch/lite';
import {
Configure,
DynamicWidgets,
Highlight,
Hits,
Expand Down Expand Up @@ -6062,6 +6077,7 @@ export function App() {

<div className=\\"container\\">
<InstantSearch searchClient={searchClient} indexName=\\"indexName\\">
<Configure hitsPerPage={8} />
<div className=\\"search-panel\\">
<div className=\\"search-panel__filters\\">
<DynamicWidgets fallback={RefinementList}>
Expand Down Expand Up @@ -8176,7 +8192,7 @@ exports[`Templates Vue InstantSearch File content: public/index.html 1`] = `
Do not use @7 in production, use a complete version like x.x.x, see website for latest version:
https://www.algolia.com/doc/guides/building-search-ui/installation/react/#load-the-style
-->
<link rel=\\"stylesheet\\" href=\\"https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/algolia-min.css\\">
<link rel=\\"stylesheet\\" href=\\"https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/satellite-min.css\\">
<title>vue-instantsearch-app</title>
</head>
<body>
Expand Down Expand Up @@ -8208,12 +8224,18 @@ exports[`Templates Vue InstantSearch File content: src/App.vue 1`] = `

<div class=\\"container\\">
<ais-instant-search :search-client=\\"searchClient\\" index-name=\\"indexName\\">
<ais-configure :hits-per-page.camel=\\"8\\" />
<div class=\\"search-panel\\">
<div class=\\"search-panel__filters\\">
<ais-configure :facets=\\"['*']\\" :max-values-per-facet.camel=\\"20\\" />
<ais-dynamic-widgets>
<ais-refinement-list attribute=\\"facet1\\" />
<ais-refinement-list attribute=\\"facet2\\" />
<ais-panel>
<template v-slot:header>facet1</template>
<ais-refinement-list attribute=\\"facet1\\" />
</ais-panel>
<ais-panel>
<template v-slot:header>facet2</template>
<ais-refinement-list attribute=\\"facet2\\" />
</ais-panel>
</ais-dynamic-widgets>
</div>

Expand Down Expand Up @@ -8443,7 +8465,7 @@ exports[`Templates Vue InstantSearch with Vue 3 File content: index.html 1`] = `
Do not use @7 in production, use a complete version like x.x.x, see website for latest version:
https://www.algolia.com/doc/guides/building-search-ui/installation/react/#load-the-style
-->
<link rel=\\"stylesheet\\" href=\\"https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/algolia-min.css\\">
<link rel=\\"stylesheet\\" href=\\"https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/satellite-min.css\\">
<title>vue-instantsearch-app</title>
</head>
<body>
Expand Down Expand Up @@ -8487,11 +8509,18 @@ exports[`Templates Vue InstantSearch with Vue 3 File content: src/App.vue 1`] =

<div class=\\"container\\">
<ais-instant-search :search-client=\\"searchClient\\" index-name=\\"indexName\\">
<ais-configure :hits-per-page.camel=\\"8\\" />
<div class=\\"search-panel\\">
<div class=\\"search-panel__filters\\">
<ais-dynamic-widgets>
<ais-refinement-list attribute=\\"facet1\\" />
<ais-refinement-list attribute=\\"facet2\\" />
<ais-panel>
<template v-slot:header>facet1</template>
<ais-refinement-list attribute=\\"facet1\\" />
</ais-panel>
<ais-panel>
<template v-slot:header>facet2</template>
<ais-refinement-list attribute=\\"facet2\\" />
</ais-panel>
</ais-dynamic-widgets>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@

<div class="container">
<ais-instantsearch [config]="config">
<ais-configure [searchParameters]="{ hitsPerPage: 8 }"></ais-configure>
<div class="search-panel">
{{#if attributesForFaceting}}
<div class="search-panel__filters">
{{#each attributesForFaceting}}
<ais-refinement-list attribute="{{this}}"></ais-refinement-list>
<ais-panel header="{{this}}">
<ais-refinement-list attribute="{{this}}"></ais-refinement-list>
</ais-panel>
{{/each}}
</div>

Expand Down
5 changes: 2 additions & 3 deletions src/templates/InstantSearch.js/index.html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<link rel="shortcut icon" href="./favicon.png">

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/algolia-min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/satellite-min.css">
<link rel="stylesheet" href="./src/index.css">
<link rel="stylesheet" href="./src/app.css">

Expand Down Expand Up @@ -43,10 +43,9 @@
<div class="search-panel__results">
<div id="searchbox"></div>
<div id="hits"></div>
<div id="pagination"></div>
</div>
</div>

<div id="pagination"></div>
</div>

<script src="https://cdn.jsdelivr.net/npm/algoliasearch@4.10.5/dist/algoliasearch-lite.umd.js"></script>
Expand Down
18 changes: 12 additions & 6 deletions src/templates/InstantSearch.js/src/app.js.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,26 @@ search.addWidgets([
},
{{/if}}
}),
{{#if flags.dynamicWidgets}}
instantsearch.widgets.configure({
facets: ['*'],
maxValuesPerFacet: 20,
hitsPerPage: 8,
}),
{{#if flags.dynamicWidgets}}
instantsearch.widgets.dynamicWidgets({
container: '#dynamic-widgets',
fallbackWidget({ container, attribute }) {
return instantsearch.widgets.refinementList({
return instantsearch.widgets.panel({ templates: { header: attribute } })(
instantsearch.widgets.refinementList
)({
container,
attribute,
});
},
widgets: [
{{#each attributesForFaceting}}
container => instantsearch.widgets.refinementList({
container =>
instantsearch.widgets.panel({
templates: { header: '{{this}}' },
})(instantsearch.widgets.refinementList)({
container,
attribute: '{{this}}',
}),
Expand All @@ -55,7 +59,9 @@ search.addWidgets([
}),
{{else}}
{{#each attributesForFaceting}}
instantsearch.widgets.refinementList({
instantsearch.widgets.panel({
templates: { header: '{{this}}' },
})(instantsearch.widgets.refinementList)({
container: '#{{this}}-list',
attribute: '{{this}}',
}),
Expand Down
2 changes: 2 additions & 0 deletions src/templates/React InstantSearch Hooks/src/App.tsx.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import algoliasearch from 'algoliasearch/lite';
import {
Configure,
{{#if flags.dynamicWidgets}}
DynamicWidgets,
{{#unless attributesForFaceting}}
Expand Down Expand Up @@ -46,6 +47,7 @@ export function App() {

<div className="container">
<InstantSearch searchClient={searchClient} indexName="{{indexName}}">
<Configure hitsPerPage={8} />
<div className="search-panel">
<div className="search-panel__filters">
{{#if flags.dynamicWidgets}}
Expand Down
2 changes: 1 addition & 1 deletion src/templates/React InstantSearch/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Do not use @7 in production, use a complete version like x.x.x, see website for latest version:
https://www.algolia.com/doc/guides/building-search-ui/installation/react/#load-the-style
-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/algolia-min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/satellite-min.css">

<title>{{name}}</title>
</head>
Expand Down
14 changes: 10 additions & 4 deletions src/templates/React InstantSearch/src/App.js.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import React from 'react';
import algoliasearch from 'algoliasearch/lite';
import {
InstantSearch,
Configure,
Hits,
SearchBox,
{{#if flags.dynamicWidgets}}
Configure,
DynamicWidgets,
Panel,
RefinementList,
{{else}}
{{#if attributesForFaceting}}
Panel,
RefinementList,
{{/if}}
{{/if}}
Expand Down Expand Up @@ -40,18 +42,22 @@ function App() {

<div className="container">
<InstantSearch searchClient={searchClient} indexName="{{indexName}}">
<Configure hitsPerPage={8} />
<div className="search-panel">
<div className="search-panel__filters">
{{#if flags.dynamicWidgets}}
<Configure facets={['*']} maxValuesPerFacet={20} />
<DynamicWidgets fallbackWidget={RefinementList}>
{{#each attributesForFaceting}}
<RefinementList attribute="{{this}}" />
<Panel header="{{this}}">
<RefinementList attribute="{{this}}" />
</Panel>
{{/each}}
</DynamicWidgets>
{{else}}
{{#each attributesForFaceting}}
<RefinementList attribute="{{this}}" />
<Panel header="{{this}}">
<RefinementList attribute="{{this}}" />
</Panel>
{{/each}}
{{/if}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/Vue InstantSearch with Vue 3/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Do not use @7 in production, use a complete version like x.x.x, see website for latest version:
https://www.algolia.com/doc/guides/building-search-ui/installation/react/#load-the-style
-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/algolia-min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/satellite-min.css">
<title>{{name}}</title>
</head>
<body>
Expand Down
11 changes: 9 additions & 2 deletions src/templates/Vue InstantSearch with Vue 3/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,24 @@
:search-client="searchClient"
index-name="{{indexName}}"
>
<ais-configure :hits-per-page.camel="8" />
<div class="search-panel">
<div class="search-panel__filters">
{{#if flags.dynamicWidgets}}
<ais-dynamic-widgets>
{{#each attributesForFaceting}}
<ais-refinement-list attribute="{{this}}" />
<ais-panel>
<template v-slot:header>{{this}}</template>
<ais-refinement-list attribute="{{this}}" />
</ais-panel>
{{/each}}
</ais-dynamic-widgets>
{{else}}
{{#each attributesForFaceting}}
<ais-refinement-list attribute="{{this}}" />
<ais-panel>
<template v-slot:header>{{this}}</template>
<ais-refinement-list attribute="{{this}}" />
</ais-panel>
{{/each}}
{{/if}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/Vue InstantSearch/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Do not use @7 in production, use a complete version like x.x.x, see website for latest version:
https://www.algolia.com/doc/guides/building-search-ui/installation/react/#load-the-style
-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/algolia-min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/satellite-min.css">
<title>{{name}}</title>
</head>
<body>
Expand Down
Loading