marianneto / store-framework

https://lab.github.com/vtex-trainings/store-framework
0 stars 0 forks source link

Search page #14

Closed github-learning-lab[bot] closed 4 years ago

github-learning-lab[bot] commented 4 years ago

Search page

:sparkles: Branch: search

Introduction

image

We've just implemented our product page and are moving on to the search page. Both are similar in the sense that both have blocks that are unique in this context. We will explore this block in a disorderly fashion for now, just to get an idea of its behavior. Then, we'll look at improving the layout.

Search Layout

Same as other templates, store.search can also be flexible. To build a unique layout you'll need to use a block called search-result-layout.

{
  "store.search": {
     "blocks": ["search-result-layout"]
  }
}

The search-result-layout, in turn, must receive 3 other blocks:

As you've already notice, the first two define which layout will be displayed on desktop and mobile respectively, while the third defines the layout of the no results found search page.

{
  "store.search": {
     "blocks": ["search-result-layout"]
  },
  "search-result-layout": {
     "blocks": [
        "search-result-layout.desktop",
        "search-result-layout.mobile",
        "search-not-found-layout"
     ]
  }
}

In the course, we'll focus on desktop layout implementation.

Search blocks

The search results documentation offers a good reference for blocks that can be use in a search context. This step will focus on highlighting the main ones:

Although quite many, all these blocks are relatively simple and work very well without an express need to configure their props.

Activity

image

Copy the code above in search.jsonc and define a search-result-layout.desktop having the following, in the order mentioned below:

:information_source: Remember to go through the Search Result documentation if you have any questions during the activity.


If you're still unsure as to how to send your answers, click here.

vtex-course-hub[bot] commented 4 years ago

Oopsie, something went wrong :crying_cat_face:

Results

:white_check_mark::x::x::x::x::x::x:

Tests

:white_check_mark: Getting the file :x: There's something wrong with your search.jsonc file :x: You didn't use search-result-layout on the store.search blocks :x: You didn't define search-result-layout :x: You did't use search-result-layout.desktop on the search-result-layout :x: You did't define search-result-layout.desktop :x: You did't use all of the expected components (breadcrumb.search, search-title.v2, total-products.v2, order-by.v2, search-fetch-previous, search-content, filter-navigator.v3, search-fetch-more)

Try again :grin:

vtex-course-hub[bot] commented 4 years ago

You did great! :grin:

Results

:white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark:

Tests

:white_check_mark: Getting the file :white_check_mark: Code compilation :white_check_mark: Use search-result-layout on the store.search :white_check_mark: Define search-result-layout :white_check_mark: Use search-result-layout.desktop on the search-result-layout :white_check_mark: Define search-result-layout.desktop :white_check_mark: Define search components

github-learning-lab[bot] commented 4 years ago

You have successfully completed this step!

Go to the next step!