Skip to content

Commit

Permalink
Add Hyper Search.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbyshaw committed Jan 8, 2024
1 parent 0afa0fd commit 8eb7cd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 139 deletions.
22 changes: 1 addition & 21 deletions templates/components/common/quick-search.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
<div class="container">
<form class="form" onsubmit="return false" data-url="{{urls.search}}" data-quick-search-form>
<fieldset class="form-fieldset">
<div class="form-field">
<label class="is-srOnly" for="{{name}}">{{lang "search.quick_search.input_label"}}</label>
<input class="form-input"
data-search-quick
name="{{name}}"
id="{{name}}"
data-error-message="{{lang 'search.error.empty_field'}}"
placeholder="{{lang 'search.quick_search.input_placeholder'}}"
autocomplete="off"
>
</div>
</fieldset>
</form>
<section class="quickSearchResults" data-bind="html: results"></section>
<p role="status"
aria-live="polite"
class="aria-description--hidden"
data-search-aria-message-predefined-text="{{{lang 'search.results.quick_count_live'}}}"
></p>
<div class="s48_hypersearch"></div>
</div>
120 changes: 2 additions & 118 deletions templates/pages/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,126 +17,10 @@
{{#partial "page"}}
{{{ stylesheet '/assets/scss/vendor/jstree/style.css' }}}
{{> components/common/breadcrumbs breadcrumbs=breadcrumbs}}
<section class="nav">
{{#if forms.search.query}}
<div id="search-results-heading">
{{>components/search/heading}}
</div>
{{/if}}
<nav class="navBar navBar--sub search-nav">
<span id="search-tabs-widget-description" class="aria-description--hidden">
{{lang 'search.tabs_accesibility_hint'}}
</span>
<ul role="tablist" class="navBar-section account-navigation" data-search-page-tabs>
<li role="presentation" class="navBar-item">
<a aria-describedby="search-tabs-widget-description" role="tab" aria-controls="product-listing-container" id="search-results-product-count" class="navBar-action" href="{{forms.search.product_url}}" data-product-results-toggle>
{{>components/search/product-count}}
</a>
</li>
<li role="presentation" class="navBar-item">
<a aria-describedby="search-tabs-widget-description" role="tab" aria-controls="search-results-content" id="search-results-content-count" class="navBar-action" href="{{forms.search.content_url}}" data-content-results-toggle>
{{>components/search/content-count}}
</a>
</li>
{{#unless product_results.faceted_search_enabled}}
<li class="navBar-item navBar-item--separate">
<a class="navBar-action toggleLink" data-collapsible="advanced-search-content" href="#" aria-controls="advanced-search-content" aria-expanded="false">
<span class="toggleLink-text toggleLink-text--on">
{{lang 'forms.search.hide'}}
</span>
<span class="toggleLink-text toggleLink-text--off">
{{lang 'forms.search.show'}}
</span>
</a>
</li>
{{/unless}}
</ul>
</nav>
{{#unless product_results.faceted_search_enabled}}
{{>components/search/advanced-search}}
{{/unless}}
</section>

<section class="page">
{{#if product_results.faceted_search_enabled}}
<aside class="page-sidebar{{#if forms.search.section '!=' 'product'}} u-hiddenVisually{{/if}}" id="faceted-search-container">
{{> components/faceted-search/index product_results}}
</aside>
{{/if}}
<div class="page-content">
{{#if forms.search.has_suggestions}}
<div class="panel panel--large">
<div class="panel-body">
{{#if forms.search.suggested_query}}
<div class="search-suggestion">
{{lang 'forms.search.did_you_mean'}} <strong>{{forms.search.suggested_query.query}}</strong>
<a href="{{forms.search.suggested_query.url}}" class="search-refine">{{lang 'forms.search.refine'}}</a>
</div>

{{#if result_count '===' 0}}
<div class="search-suggestion">
<p>
{{lang 'forms.search.your_search_for'}}
"<strong>{{{sanitize forms.search.query}}}</strong>"
{{lang 'forms.search.no_match'}}
</p>
</div>
{{/if}}
{{/if}}

{{#if category_results.length}}
<div class="search-suggestion">
<h5 class="suggestion-title">{{lang 'forms.search.categories'}}</h5>
<ul class="category-suggestion-list">

{{#each category_results}}
<li class="category-suggestion">

{{#each this}}
<a href="{{url}}">{{name}}</a>
{{#unless @last}} > {{/unless}}
{{/each}}

</li>
{{/each}}
</ul>
</div>
{{/if}}

{{#if brand_results.length}}
<div class="search-suggestion">
<h5 class="suggestion-title">{{lang 'forms.search.brand'}}</h5>
{{#each brand_results}}
<a href="{{url}}">{{name}}</a>
{{#unless @last}}, {{/unless}}
{{/each}}
</div>
{{/if}}

{{#if result_count '===' 0}}
<div class="search-suggestion">
<h5 class="suggestion-title">{{lang 'forms.search.suggestions.title'}}</h5>
<ul>
<li>{{lang 'forms.search.suggestions.line1'}}</li>
<li>{{lang 'forms.search.suggestions.line2'}}</li>
<li>{{lang 'forms.search.suggestions.line3'}}</li>
</ul>
</div>
{{/if}}
</div>
</div>
{{/if}}

<div role="tabpanel" id="search-results-content" aria-labelledby="search-results-content-count" {{#if forms.search.section '!=' 'content'}}class="u-hidden"{{/if}}>
{{> components/search/content-listing}}
</div>

<div role="tabpanel" id="product-listing-container" aria-labelledby="search-results-product-count" {{#if forms.search.section '!=' 'product'}}class="u-hidden"{{/if}}>
{{> components/search/product-listing}}
</div>

{{{region name="search_below_content"}}}
</div>
<div id="s48_hypersearch-results"></div>
{{{region name="search_below_content"}}}
</section>

{{/partial}}
Expand Down

0 comments on commit 8eb7cd1

Please sign in to comment.