Skip to content

Commit c5ea5f1

Browse files
authored
Merge pull request #168 from w3bdesign/dev
Completed a basic Algolia search page design that is working
2 parents 4fa3de9 + 0c47885 commit c5ea5f1

File tree

2 files changed

+35
-13
lines changed

2 files changed

+35
-13
lines changed

components/Header/Navbar.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@
3232
<ul
3333
class="items-center justify-end flex-1 pr-4 -mr-4 list-reset lg:flex"
3434
>
35-
<li
36-
class="inline-block py-2 text-xl font-semibold no-underline lg:text-base lg:px-4"
37-
>
38-
<Search />
39-
</li>
4035
<li
4136
class="inline-block py-2 text-xl font-semibold no-underline lg:text-base lg:px-4"
4237
>
@@ -68,6 +63,16 @@
6863
>
6964
</NuxtLink>
7065
</li>
66+
<li
67+
class="inline-block py-2 text-xl font-semibold no-underline lg:text-base lg:px-4"
68+
>
69+
<NuxtLink to="/search">
70+
<span
71+
class="text-xl text-white no-underline lg:text-black is-active"
72+
>Search</span
73+
>
74+
</NuxtLink>
75+
</li>
7176
<li
7277
class="inline-block py-2 text-xl font-semibold no-underline lg:text-base lg:px-4"
7378
>

pages/search.vue

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,44 @@
55
<ais-refinement-list attribute="brand" />
66
<ais-hits>
77
<template slot="item" slot-scope="{ item }">
8-
<p>
9-
<ais-highlight attribute="product_name" :hit="item" />
10-
</p>
11-
<p>
12-
<ais-highlight attribute="short_description" :hit="item" />
8+
<NuxtLink
9+
class="text-black cursor-pointer hover:underline"
10+
:to="{
11+
path: '/product/' + item.product_name,
12+
query: { id: item.objectID },
13+
}"
14+
>
15+
<p class="p-2 text-2xl font-bold text-center">
16+
{{ item.product_name }}
17+
</p>
18+
</NuxtLink>
19+
20+
<p class="p-2 text-xl text-center">
21+
{{ item.short_description }}
1322
</p>
14-
<p>
23+
<p class="p-2">
1524
<img :src="item.product_image" alt="item.product_name" />
1625
</p>
26+
<p class="p-2 text-xl text-center">
27+
{{ item.sale_price ? item.sale_price : item.regular_price }} kr
28+
</p>
1729
</template>
1830
</ais-hits>
1931
<ais-pagination />
2032
</ais-instant-search-ssr>
2133
</template>
2234

2335
<script>
36+
// TODO
37+
/*
38+
Replace empty spaces with dash (-)
39+
40+
const trimmedProductName = product_name.replace(/ /g, '-');
41+
*/
2442
import {
2543
AisInstantSearchSsr,
2644
AisRefinementList,
2745
AisHits,
28-
AisHighlight,
2946
AisSearchBox,
3047
AisStats,
3148
AisPagination,
@@ -44,7 +61,6 @@ export default {
4461
AisInstantSearchSsr,
4562
AisRefinementList,
4663
AisHits,
47-
AisHighlight,
4864
AisSearchBox,
4965
AisStats,
5066
AisPagination,
@@ -55,6 +71,7 @@ export default {
5571
indexName: process.env.AlgoliaIndexName,
5672
}),
5773
],
74+
layout: 'Layout',
5875
serverPrefetch() {
5976
return this.instantsearch.findResultsState(this).then((algoliaState) => {
6077
this.$ssrContext.nuxt.algoliaState = algoliaState

0 commit comments

Comments
 (0)