Closed github-learning-lab[bot] closed 4 years ago
:white_check_mark::x::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: Getting the file
:x: Could not find a tab-layout#home
block among the blocks for store.custom#about-us
:white_check_mark: Declare the block tab-layout#home
with tab-list#home
and tab-content#home
block as children
:white_check_mark: Declare the block tab-list#home
with two tab-list.item
blocks as children
:white_check_mark: Make tab-list.item#home1 block show "Major Appliances"
:white_check_mark: Make tab-list.item#home2 block show "Electronics"
:white_check_mark: Create tab-content#home
with two tab-content.item
blocks
:white_check_mark: Create tab-content#home
with two tab-content.item
blocks
:white_check_mark: Add rich-text
blocks to each tab-content.item
:white_check_mark: Add tabId
s to tab-content.item
s
:white_check_mark: Declare the expected rich-text
blocks that should show up in each tab
: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: Getting the file
:white_check_mark: Add a tab-layout#home
to your store.custom
template
:white_check_mark: Declare the block tab-layout#home
with tab-list#home
and tab-content#home
block as children
:white_check_mark: Declare the block tab-list#home
with two tab-list.item
blocks as children
:white_check_mark: Make tab-list.item#home1 block show "Major Appliances"
:white_check_mark: Make tab-list.item#home2 block show "Electronics"
:white_check_mark: Create tab-content#home
with two tab-content.item
blocks
:white_check_mark: Create tab-content#home
with two tab-content.item
blocks
:white_check_mark: Add rich-text
blocks to each tab-content.item
:white_check_mark: Add tabId
s to tab-content.item
s
:white_check_mark: Declare the expected rich-text
blocks that should show up in each tab
Tab layout
:sparkles: Branch: tab-layout
Introduction
Tab Layout is layout structuring paradigm created in Store Framework to allow the creation of layouts with tabs.
We have the following two containers in this paradigm:
tab-list
andtab-content
. Each of these containers contains the items that it's comprised of. Intab-list
, we havetab-list.item
, whereas intab-content
, we havetab-content.item
, respectively.We'll look at a tab layout implementation example below.
First, you need to declare the
tab-layout
block in the desired template:Then, you need to declare a
tab-list
and atab-content
astab-layout
's children:Having done this, these two containers are components of our
tab-layout
. The next step is to declaretab-list.item
andtab-content.item
astab-list
's andtab-content
's children:In the next step, we'll declare the
tab-list.item
properties. The code below creates a tab interface similar to the image below:The
tabId
property is very important as it's the key that connect atab-list.item
button with atab-content.item
.Now, let's declare the children and props pertaining to
tab-content.item
.In the child array, you can include several blocks such as
rich-text
,info-card
,image
,flex-layout
and etc.In the
tabId
prop, you need to include the same ids that were declared intab-list.item
for the link between the tab and content to function properly.Lastly, you must declare your content's proprieties. In our example, we just placed a
rich-text
in eachtab-content.item
:Activity
In this activity, we will create the simple structure of a tab layout, as shown below. Thereafter, we will add some content to give our page a custom style.
about-us.jsonc
, add atab-layout#home
to thestore.custom#about-us
template;tab-layout#home
block and addtab-list#home
andtab-content#home
as its children;tab-list#home
and addtab-list.item#home1
andtab-list.item#home2
as its children;tab-list.item#home1
so that the interface displays "Major Appliances". (Tip: Do not forget to includetabId
="majorAppliances"
as well as the propertydefaultActiveTab
=true
to the props);tab-list.item#home2
's props so that the interface displays "Electronics". (Tip: Don't forget to includetabId
="electronics"
to the props);tab-content#home
in your theme and addtab-content.item#home1
andtab-content.item#home2
as children;tab-content.item
, declare just onerich-text
as child (for example,rich-text#home1
andrich-text#home2
);tabId
prop for eachtab-content.item
to create a link between the previously createdtab-list
andtab-content
;Lastly, add the
rich-text
and declare its props according to the code below::information_source: Remember to access the Tab Layout and Rich Text documentation for any questions during the activity.
If you're still unsure as to how to send your answers, click here.