Open github-learning-lab[bot] opened 4 years ago
:white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::x::x::x::x::x::x::x::x::x::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark:
:white_check_mark: Fetching files :white_check_mark: Code compilation: header.jsonc :white_check_mark: Code compilation: menu-items.jsonc :white_check_mark: Code compilation: menu.jsonc :white_check_mark: Major Appliances Menu item must contain correct submenu :white_check_mark: Small Appliances Menu item must contain correct submenu :white_check_mark: Electronics Menu item must contain correct submenu :white_check_mark: Main Category Menu must be stated :white_check_mark: Main Category Menu must have correct children :white_check_mark: Main Category Menu must be on horizontal orientation :x: You havent declared vtex.menu@2.x:menu#major on your menu.jsonc file :x: You havent declared the children menu-item#refrigerators, menu-item#ovens, menu-item#washers on vtex.menu@2.x:menu#major :x: You havent declared props "orientation" as "vertical" on vtex.menu@2.x:menu#major :x: You havent declared vtex.menu@2.x:menu#small on your menu.jsonc file :x: You havent declared the children menu-item#mixers, menu-item#toasters, menu-item#coffee on vtex.menu@2.x:menu#small :x: You havent declared props "orientation" as "vertical" on vtex.menu@2.x:menu#small :x: You havent declared vtex.menu@2.x:menu#electronics on your menu.jsonc file :x: You havent declared the children menu-item#cameras, menu-item#laptops, menu-item#tvs on vtex.menu@2.x:menu#electronics :x: You havent declared props "orientation" as "vertical" on vtex.menu@2.x:menu#electronics :white_check_mark: Menu row must be placed as last child of header :white_check_mark: Drawer must be placed as first child of header mobile :white_check_mark: Menu row must have correct children :white_check_mark: Major Submenu must have major menu as children :white_check_mark: Small Submenu must have small menu as children :white_check_mark: Electronics Submenu must have electronics menu as children
:white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark:
:white_check_mark: Fetching files :white_check_mark: Code compilation: header.jsonc :white_check_mark: Code compilation: menu-items.jsonc :white_check_mark: Code compilation: menu.jsonc :white_check_mark: Major Appliances Menu item must contain correct submenu :white_check_mark: Small Appliances Menu item must contain correct submenu :white_check_mark: Electronics Menu item must contain correct submenu :white_check_mark: Main Category Menu must be stated :white_check_mark: Main Category Menu must have correct children :white_check_mark: Main Category Menu must be on horizontal orientation :white_check_mark: Major Appliances Menu must be stated :white_check_mark: Major Appliances must have correct children :white_check_mark: Major Appliances Menu must be on vertical orientation :white_check_mark: Small Appliances Menu must be stated :white_check_mark: Small Appliances must have correct children :white_check_mark: Small Appliances Menu must be on vertical orientation :white_check_mark: Electronics Menu must be stated :white_check_mark: Electronics Menu must have correct children :white_check_mark: Electronics Menu must be on vertical orientation :white_check_mark: Menu row must be placed as last child of header :white_check_mark: Drawer must be placed as first child of header mobile :white_check_mark: Menu row must have correct children :white_check_mark: Major Submenu must have major menu as children :white_check_mark: Small Submenu must have small menu as children :white_check_mark: Electronics Submenu must have electronics menu as children
Menu
:sparkles: Branch: menu
Introduction
Having already configured and implemented the header, let's now add it to the Menu. Configuring the Menu is an important step in building your theme, since it's the block that's responsible for the user's navigation in your store. Because of its function and relevance, the Menu possesses a complex hierarchical structure, which involves menu items, submenus and, based on the latter, any Store Framework block (such as other Menus e Menu Items). Below we can see an image highlighting the Menu block's structure in practice:
Configuring the Menu
When compared to some of the other blocks, the Menu's configuration may seem more difficult due to its structure of menus, menu items and submenus. However the Menu does not necessarily need to be configured according to the most complex scenario. Below, we can check a basic implementation example for the block, containing just the following 3 Menu Items:
Activity
This activity will help us understand more about configuring the Menu, in addition to its existing hierarchy based on building Menu Items and Submenus.
In `header.jsonc`, add `header-row#menu` as the last item on the `header-layout.desktop` block's child list (configured during the previous activity), so that the Menu can be rendered by the store's Header;
Copy and paste the code below to declare the
header-row#menu
block:We also need to deal with the layout Menu for other devices, such as mobile. Therefore, add the
drawer
as theheader-row#main-mobile
block's first child;Copy the code in the
menu.jsonc
code to horizontally render the 3 main Menu items:As we've seen in the introduction, a Menu Item can allow the configuration of a Submenu which in turn can have another Menu with its own Menu Items. Therefore, create a Submenu for Major Appliances, still in
menu.jsonc
, according to the example below:Following the format established by the
vtex.menu@2.x:menu#categories\
block, build a secondary Major Appliances Menu, declared in the last step inmenu.jsonc
. You must set theorientation
prop value tovertical
and configure the following Menu Items in the block's children list:menu-item#refrigerators
,menu-item#ovens
andmenu-item#washers
;In addition, create a Small Appliances submenu:
Now build the Small Appliances secondary menu in
menu.jsonc
. As with the Major Appliances, you must set theorientation
prop value tovertical
and configure the following Menu Items in the block children list:menu-item#mixers
,menu-item#toasters
andmenu-item#coffee
;Based on the previous steps, do the same with Electronics: create your Submenu (`vtex.menu@2.x:submenu#electronics`) and secondary Menu. Thereafter, build the latter with the same prop value (`vertical`) and configure the following Menu Items in the block's children list:
menu-item#cameras
,menu-item#laptops
andmenu-item#tvs
.:information_source: Remember to access the Menu's documentação if your have any questions during the activity.
Expected result:
If you're still unsure as to how to send your answers, click here.