I need your help in creating a new section in the Impulse theme. In the file I am sharing, there is a Liquid file for tabs. The tabs currently allow me to add four types of blocks: image, liquid, product, and collection.
I want to create a similar tab section but with the ability to add Advanced Content to the tabs as a block.
Here is tabs section code:
Create a new section :section-tab.liquid and paste all below code in that section
{{ section.settings.section_title | escape }}
{% endif %} {% if section.settings.subheading != blank %}assign product_limit = block.settings.grid | times: block.settings.rows
-%}
-
{% for product in collection.products limit: product_limit %}
- {% include 'product-card-grid', max_height: max_height, product: product, show_vendor: block.settings.show_vendor %} {% else %}
-
{{ 'homepage.onboarding.product_title' | t }}{% capture current %}{% cycle 1, 2, 3, 4, 5, 6 %}{% endcapture %} {{ 'product-' | append: current | placeholder_svg_tag: 'placeholder-svg' }}{{ 'homepage.onboarding.product_title' | t }}{% include 'product-price' %}
{% endfor %}
{% endfor %}
{% for i in (1..product_limit) %}
.tabs .line {
position: absolute;
left: 0;
bottom: 0;
width: 0;
height: 6px;
border-radius: 15px;
background-color: {{ section.settings.line_color }};
transition: all 0.2s ease;
}
.tab-item {
min-width: 80px;
padding: 16px 20px 11px 20px;
font-size: 20px;
text-align: center;
flex: 1;
color: {{ section.settings.button_color }};
background-color: {{ section.settings.button_background }};
cursor: pointer;
transition: all 0.5s ease;
}
.tab-icon {
font-size: 24px;
width: 32px;
position: relative;
top: 2px;
}
.tab-item.active,
.tab-item:hover {
color: {{ section.settings.button_hover_color }};
background-color: {{ section.settings.button_hover_background }};
}
.tab-content {
padding: 28px 0;
}
.tab-pane {
color: #333;
display: none;
}
.tab-pane.active {
display: block;
}
.tab-pane h2 {
font-size: 24px;
margin-bottom: 8px;
}
{% schema %}
{
“name”: “Tab Section”,
“max_blocks”: 5,
“settings”: [
{
“type”: “text”,
“id”: “section_title”,
“label”: “Heading”,
“default”: “Talk about your brand”
},
{
“type”: “richtext”,
“id”: “subheading”,
“label”: “Subheading”,
“default”: “
Use this text to share information about your brand with your customers. Describe a product, share announcements, or welcome customers to your store.
”},
{
“type”: “header”,
“content”: “Tab Settings”
},
{
“type”: “color”,
“id”: “button_color”,
“label”: “Button color”,
“default”: “#ffffff”
},
{
“type”: “color”,
“id”: “button_background”,
“label”: “Button background”,
“default”: “#3a3a3a”
},
{
“type”: “color”,
“id”: “button_hover_color”,
“label”: “Hover color”,
“default”: “#3a3a3a”
},
{
“type”: “color”,
“id”: “button_hover_background”,
“label”: “Hover background”,
“default”: “#fed7e0”
}
],
“blocks”: [
{
“type”: “image”,
“name”: “Block image”,
“settings”: [
{
“type”: “text”,
“id”: “heading”,
“label”: “Heading”,
“default”: “Tab heading”
},
{
“type”: “image_picker”,
“id”: “image”,
“label”: “Image”
},
{
“type”: “url”,
“id”: “image_url”,
“label”: “Link”
}
]
},
{
“type”: “html”,
“name”: “Block html”,
“settings”: [
{
“type”: “text”,
“id”: “heading”,
“label”: “Heading”,
“default”: “Tab heading”
},
{
“type”: “html”,
“id”: “html”,
“label”: “HTML code”
}
]
},
{
“type”: “liquid”,
“name”: “Block liquid”,
“settings”: [
{
“type”: “text”,
“id”: “heading”,
“label”: “Heading”,
“default”: “Tab heading”
},
{
“type”: “liquid”,
“id”: “liquid”,
“label”: “Liquid code”
}
]
},
{
“type”: “collection”,
“name”: “Block collection”,
“settings”: [
{
“type”: “text”,
“id”: “heading”,
“label”: “Heading”,
“default”: “Tab heading”
},
{
“type”: “collection”,
“id”: “collection”,
“label”: “collection”
},
{
“type”: “range”,
“id”: “grid”,
“label”: “Products per row”,
“min”: 2,
“max”: 5,
“step”: 1,
“default”: 3
},
{
“type”: “range”,
“id”: “rows”,
“label”: “Rows”,
“min”: 1,
“max”: 5,
“step”: 1,
“default”: 2
}
]
}
],
“presets”: [
{
“name”: “Tab Section”,
“category”: “Tab Section”
}
]
}
{% endschema %}