From e707d803bae378b16cf458ce301ffeda84eb0b07 Mon Sep 17 00:00:00 2001 From: Fabien Motte Date: Wed, 18 May 2022 16:50:32 +0200 Subject: [PATCH] docs(two-column-layout-example): remove useless item template override (#973) --- .../src/plugins/querySuggestionsPlugin.tsx | 61 ------------------ .../src/plugins/recentSearchesPlugin.tsx | 64 ------------------- 2 files changed, 125 deletions(-) diff --git a/examples/two-column-layout/src/plugins/querySuggestionsPlugin.tsx b/examples/two-column-layout/src/plugins/querySuggestionsPlugin.tsx index 733b05926..6901deb8c 100644 --- a/examples/two-column-layout/src/plugins/querySuggestionsPlugin.tsx +++ b/examples/two-column-layout/src/plugins/querySuggestionsPlugin.tsx @@ -1,6 +1,4 @@ -/** @jsx h */ import { createQuerySuggestionsPlugin } from '@algolia/autocomplete-plugin-query-suggestions'; -import { h } from 'preact'; import { ALGOLIA_PRODUCTS_QUERY_SUGGESTIONS_INDEX_NAME } from '../constants'; import { searchClient } from '../searchClient'; @@ -13,63 +11,4 @@ export const querySuggestionsPlugin = createQuerySuggestionsPlugin({ hitsPerPage: !state.query ? 0 : 10, }; }, - transformSource({ source, onTapAhead }) { - return { - ...source, - templates: { - ...source.templates, - item({ item, components }) { - if (item.__autocomplete_qsCategory) { - return ( -
-
-
- - - in{' '} - - {item.__autocomplete_qsCategory} - - -
-
-
- ); - } - - return ( -
-
-
- - - -
-
-
- -
-
-
-
- -
-
- ); - }, - }, - }; - }, }); diff --git a/examples/two-column-layout/src/plugins/recentSearchesPlugin.tsx b/examples/two-column-layout/src/plugins/recentSearchesPlugin.tsx index eb248e6e5..0f49950ca 100644 --- a/examples/two-column-layout/src/plugins/recentSearchesPlugin.tsx +++ b/examples/two-column-layout/src/plugins/recentSearchesPlugin.tsx @@ -1,75 +1,11 @@ -/** @jsx h */ import { createLocalStorageRecentSearchesPlugin, search, } from '@algolia/autocomplete-plugin-recent-searches'; -import { h } from 'preact'; export const recentSearchesPlugin = createLocalStorageRecentSearchesPlugin({ key: 'autocomplete-two-column-layout-example', search(params) { return search({ ...params, limit: params.query ? 1 : 4 }); }, - transformSource({ source, onRemove, onTapAhead }) { - return { - ...source, - templates: { - ...source.templates, - item({ item, components }) { - return ( -
-
-
- - - -
-
-
- - {item.category && ( - - in{' '} - - {item.category} - - - )} -
-
-
-
- - -
-
- ); - }, - }, - }; - }, });