zz-shopify-components 0.25.1-beta.8 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -80,7 +80,7 @@
80
80
  .panel-inner {
81
81
  transform-origin: center center;
82
82
  transform: translateY(8px) scale(0.98);
83
- max-height: var(--zz-modal-max-height, 100vh);
83
+ max-height: var(--zz-modal-max-height, 85vh);
84
84
  }
85
85
  }
86
86
 
@@ -195,6 +195,11 @@
195
195
  this._closeBtn = shadow.querySelector('[data-zz-modal-close]');
196
196
  this._slotHeader = shadow.querySelector('slot[name="header"]');
197
197
  this._slotFooter = shadow.querySelector('slot[name="footer"]');
198
+ this._closeIconPath = shadow.querySelector('.close-btn svg path');
199
+
200
+ if (!this._closeIconPath) return;
201
+ const color = this.getAttribute('close-icon-color') || 'currentColor';
202
+ this._closeIconPath.setAttribute('stroke', color);
198
203
  }
199
204
 
200
205
  connectedCallback() {
@@ -262,6 +262,12 @@
262
262
  "type": "header",
263
263
  "content": "统计相关"
264
264
  },
265
+ {
266
+ "type": "text",
267
+ "id": "module_name",
268
+ "label": "模块名称",
269
+ "info": "用于定位到本模块,可多个section使用同一名称"
270
+ },
265
271
  {
266
272
  "type": "text",
267
273
  "id": "module_id",
@@ -643,6 +649,9 @@
643
649
  </style>
644
650
 
645
651
  <div
652
+ {% if block.settings.module_name != blank %}
653
+ data-zz-module-name="{{ block.settings.module_name }}"
654
+ {% endif %}
646
655
  {% if block.settings.module_id != blank %}
647
656
  data-track-zz-block="{{ block.settings.module_id }}"
648
657
  {% endif %}
@@ -0,0 +1,190 @@
1
+ {% assign product = all_products[block.settings.product] %}
2
+ {% assign variant_id = block.settings.variant_id | times: 1 %}
3
+ {% assign variant = product.variants | where: 'id', variant_id | first %}
4
+
5
+ {% if block.settings.price_type == 'hand' %}
6
+ {% assign price = block.settings.price | times: 100 %}
7
+ {% assign before_price = block.settings.before_price | times: 100 %}
8
+ {% assign discount_value = before_price | minus: price %}
9
+ {% else %}
10
+ {% assign discount_value = variant.compare_at_price | minus: variant.price %}
11
+ {% endif %}
12
+
13
+
14
+
15
+
16
+ {% assign btn_class = 'zz-Price-Bundle-' | append: block.id %}
17
+
18
+ <div class="zz-price-bundle-bg tw-relative tw-aspect-[59/33] tw-rounded-t-[10px] lg:tw-rounded-t-[16px] tw-overflow-hidden">
19
+ {% render 'zz-img',
20
+ pc_image: block.settings.desktop_bg_image,
21
+ mb_image: block.settings.mobile_bg_image,
22
+ image_alt: block.settings.heading | escape,
23
+ class_name: "zz-price-bundle-bg-image tw-w-full tw-h-full tw-object-cover",
24
+ %}
25
+ <div class="tw-absolute lg:tw-bottom-[35px] tw-left-[24px] tw-right-[24px] tw-bottom-[16px] lg:tw-left-[30px] lg:tw-right-[30px]">
26
+ <div class="tw-w-full">
27
+ <p class="tw-font-bold tw-text-[28px] tw-leading-1 tw-text-white">{{ block.settings.heading }}</p>
28
+ {% if block.settings.price_type == 'hand' %}
29
+ <p class='tw-font-bold tw-text-left tw-italic tw-leading-[1.2] tw-text-[28px] lg:tw-text-[40px] tw-text-white'>
30
+ {{ block.settings.price | times: 100 | money_without_trailing_zeros }}
31
+ </p>
32
+ {% else %}
33
+ <p class='tw-font-bold tw-text-left tw-italic tw-leading-[1.2] tw-text-[28px] lg:tw-text-[40px] tw-text-white'>
34
+ {{ variant.price | money_without_trailing_zeros }}
35
+ </p>
36
+ {% endif %}
37
+
38
+ <div class="tw-flex tw-justify-between">
39
+ <div>
40
+ {% if block.settings.price_type == 'hand' %}
41
+ <span class='tw-italic tw-line-through tw-text-[12px] lg:tw-text-[20px] tw-text-[#FFFFFFB2]'>
42
+ {{ block.settings.before_price | times: 100 | money_without_trailing_zeros }}
43
+ </span>
44
+ {% else %}
45
+ <span class='tw-italic tw-line-through tw-text-[12px] lg:tw-text-[20px] tw-text-[#FFFFFFB2]'>
46
+ {{ variant.compare_at_price | money_without_trailing_zeros }}
47
+ </span>
48
+ {% endif %}
49
+
50
+ {% if block.settings.price_type == 'hand' %}
51
+ <span class='tw-border-white tw-text-white tw-ml-[8px] tw-border-[1px] tw-py-[4px] tw-pr-[6px] tw-pl-[6px] tw-text-[10px] lg:tw-text-[14px] tw-leading-[1.3] tw-border-solid tw-rounded-[4px]'>
52
+ SAVE {{ discount_value | money_without_trailing_zeros }}
53
+ </span>
54
+ {% else %}
55
+ <span class='tw-font-bold tw-text-[20px] tw-text-black'>
56
+ {{ discount_value | money_without_trailing_zeros }}
57
+ </span>
58
+ {% endif %}
59
+ </div>
60
+ {% render 'zz-button',
61
+
62
+ type: 'primary',
63
+ color: 'white',
64
+ text: block.settings.btn_text,
65
+ size: 'medium',
66
+ class_name: btn_class,
67
+ btn_id: block.settings.btn_id
68
+ %}
69
+ </div>
70
+ </div>
71
+
72
+ </div>
73
+
74
+ </div>
75
+ {% render 'zz-img',
76
+ pc_image: block.settings.desktop_bundle_image,
77
+ mb_image: block.settings.mobile_bundle_image,
78
+ image_alt: block.settings.heading | escape,
79
+ class_name: "tw-w-full tw-h-auto tw-object-cover tw-rounded-b-[10px] lg:tw-rounded-b-[16px] ",
80
+ %}
81
+ {% schema %}
82
+ {
83
+ "name": "Price Bundle Card",
84
+ "class": "zz-price-bundle",
85
+ "settings": [
86
+ {
87
+ "type": "text",
88
+ "id": "heading",
89
+ "label": "bundle标题",
90
+ },
91
+ {
92
+ "type": "select",
93
+ "id": "price_type",
94
+ "label": "价格设置",
95
+ "options": [
96
+ { "value": "hand", "label": "手动设置,官网" },
97
+ { "value": "auto", "label": "自动设置,站点" },
98
+
99
+ ],
100
+ "default": "auto",
101
+ "info": "自动设置根据产品自动调整,适合站点"
102
+ },
103
+ {
104
+ "type": "product",
105
+ "id": "product",
106
+ "label": "Product",
107
+ "info": "选择产品,不适合官网",
108
+ },
109
+ {
110
+ "type": "text",
111
+ "id": "variant_id",
112
+ "label": "Variant ID",
113
+ "placeholder": "变体ID",
114
+ "info": "输入变体ID,变体ID可以在产品编辑页面查看,不适合官网"
115
+ },
116
+ {
117
+ "type": "number",
118
+ "id": "price",
119
+ "label": "价格",
120
+ "info": "手动设置时使用"
121
+ },
122
+ {
123
+ "type": "number",
124
+ "id": "before_price",
125
+ "label": "划线价格",
126
+ "info": "手动设置时使用"
127
+ },
128
+ {
129
+ "type": "image_picker",
130
+ "id": "desktop_bg_image",
131
+ "label": "PC端背景图片"
132
+ },
133
+ {
134
+ "type": "image_picker",
135
+ "id": "mobile_bg_image",
136
+ "label": "移动端背景图片"
137
+ },
138
+ {
139
+ "type": "image_picker",
140
+ "id": "desktop_bundle_image",
141
+ "label": "PC端bundle图片"
142
+ },
143
+ {
144
+ "type": "image_picker",
145
+ "id": "mobile_bundle_image",
146
+ "label": "移动端bundle图片"
147
+ },
148
+ {
149
+ "type": "text",
150
+ "id": "btn_text",
151
+ "label": "按钮文案",
152
+ "default": "Buy Now"
153
+ },
154
+ {
155
+ "type": "textarea",
156
+ "id": "links",
157
+ "label": "Sites Link Map",
158
+ "info": "国家对应链接的表,国家即是国家选择器上显示的字段,国家和路由之间用冒号隔开( 冒号后要加空格)。国家之间换行,“default”为其他未写的默认的链接 EG: Canada: https://hoverair.com/ default: https://hoverair.com/ ",
159
+ },
160
+ {
161
+ "type": "text",
162
+ "id": "btn_id",
163
+ "label": "按钮id",
164
+ "info": "按钮的唯一id,用于代码控制、埋点统计等"
165
+ },
166
+
167
+ ],
168
+ "presets": [
169
+ {
170
+ "name": "Price Bundle Card"
171
+ }
172
+ ]
173
+ }
174
+
175
+
176
+ {% endschema %}
177
+
178
+
179
+ <script>
180
+ document.addEventListener('DOMContentLoaded', (event) => {
181
+ const btn = document.getElementsByClassName('{{ btn_class }}')
182
+ if(btn && btn[0]) {
183
+
184
+ if(window.bindSiteJump) {
185
+ bindSiteJump(btn[0], {{ block.settings.links | json }})
186
+ }
187
+ }
188
+
189
+ })
190
+ </script>
@@ -15,6 +15,10 @@
15
15
  #shopify-block-{{block.id}} {
16
16
  width: 340px;
17
17
  }
18
+ #shopify-block-{{block.id}}.swiper-slide-active {
19
+ width: 400px;
20
+ }
21
+
18
22
  #shopify-block-{{block.id}} .image-video-box {
19
23
  width: 100%;
20
24
  aspect-ratio: 400 / 225;
@@ -25,6 +29,10 @@
25
29
  #shopify-block-{{block.id}} {
26
30
  width: 400px;
27
31
  }
32
+ #shopify-block-{{block.id}}.swiper-slide-active {
33
+ width: 480px;
34
+ }
35
+
28
36
  }
29
37
 
30
38
 
@@ -36,8 +36,8 @@
36
36
  {% assign nickname_color = block.settings.text_color
37
37
  | color_modify: 'alpha', 0.6
38
38
  %}
39
- <p class="zz-title-comment-item-name tw-text-[14px] tw-ml-[12px] tw-font-semibold" style="color: {{ block.settings.text_color }};">{{ block.settings.name }}</p>
40
- <p class="zz-title-comment-item-nickname tw-text-[14px] tw-ml-[12px]" style="color: {{ nickname_color }};">{{ block.settings.nickname }}</p>
39
+ <p class="zz-title-comment-item-name tw-leading-[1.2] tw-text-[14px] tw-ml-[12px] tw-font-semibold" style="color: {{ block.settings.text_color }};">{{ block.settings.name }}</p>
40
+ <p class="zz-title-comment-item-nickname tw-leading-[1.5] tw-text-[14px] tw-ml-[12px]" style="color: {{ nickname_color }};">{{ block.settings.nickname }}</p>
41
41
  </div>
42
42
  </div>
43
43
 
@@ -51,7 +51,7 @@
51
51
  </style>
52
52
 
53
53
 
54
- <div class="expand-btn tw-cursor-pointer tw-absolute tw-top-[20px] tw-right-[20px] max-lg:tw-top-[30px] tw-z-10">
54
+ <div class="expand-btn tw-cursor-pointer tw-absolute tw-top-[20px] tw-right-[20px] lg:tw-top-[30px] tw-z-10">
55
55
  <svg class="expand-icon" width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
56
56
  <foreignObject x="-12" y="-12" width="72" height="72"><div xmlns="http://www.w3.org/1999/xhtml" style="backdrop-filter:blur(6px);clip-path:url(#bgblur_0_1547_3589_clip_path);height:100%;width:100%"></div></foreignObject><rect data-figma-bg-blur-radius="12" width="48" height="48" rx="24" fill="black" fill-opacity="0.3"/>
57
57
  <path d="M16 24H32" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
@@ -109,10 +109,10 @@
109
109
 
110
110
  <div class="tw-absolute tw-bottom-0 tw-left-0 tw-right-0 tw-box-border tw-pl-[20px] tw-pr-[20px] tw-pb-[20px] lg:tw-pl-[30px] lg:tw-pr-[30px] lg:tw-pb-[30px]">
111
111
 
112
- <div class='tw-font-normal tw-text-white tw-text-[16px]'>
112
+ <div class='tw-font-normal tw-text-white tw-text-[12px] lg:tw-text-[16px]'>
113
113
  {{ block.settings.heading }}
114
114
  </div>
115
- <div class='tw-font-semibold tw-text-white tw-text-[28px] tw-leading-[1.3]'>
115
+ <div class='tw-font-[600] tw-text-white tw-text-[18px] lg:tw-text-[28px] tw-leading-[1.3]'>
116
116
  {{ block.settings.description }}
117
117
  </div>
118
118
 
@@ -235,6 +235,7 @@
235
235
  const autoHeight = {{ block.settings.fixed_height }};
236
236
  const centeredSlides = {{ block.settings.if_center }};
237
237
  const initialSlide = {{ block.settings.pc_initial_slide }} - 1;
238
+ const loop = {{ block.settings.loop }};
238
239
  let isDesktop = window.innerWidth > 1023;
239
240
  // 获取 class zz-accessories-swiper 的元素 且data-id 为 block.id 的元素
240
241
  const zzAccessoriesSwiper = document.querySelector(swiperClassName);
@@ -258,6 +259,7 @@
258
259
  nextEl: zzAccessoriesSwiper.querySelector('.swiper-button-next'),
259
260
  prevEl: zzAccessoriesSwiper.querySelector('.swiper-button-prev'),
260
261
  },
262
+ loop: loop,
261
263
  pagination: {
262
264
  el: zzAccessoriesSwiper.querySelector('.swiper-pagination'),
263
265
  clickable: true,
@@ -496,6 +498,12 @@
496
498
  ],
497
499
  "default": "pos"
498
500
  },
501
+ {
502
+ "type": "checkbox",
503
+ "id": "loop",
504
+ "label": "loop 视频循环播放",
505
+ "default": false
506
+ },
499
507
  {
500
508
  "type": "checkbox",
501
509
  "id": "if_mb_btn",
@@ -519,7 +527,8 @@
519
527
  "id": "fixed_height",
520
528
  "label": "强制高度一致",
521
529
  "default": false
522
- }
530
+ },
531
+
523
532
  ],
524
533
  "blocks": [
525
534
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zz-shopify-components",
3
- "version": "0.25.1-beta.8",
3
+ "version": "0.26.0",
4
4
  "description": "Reusable Shopify components for theme projects",
5
5
  "keywords": [
6
6
  "shopify",
@@ -46,6 +46,7 @@
46
46
  {% if section.settings.is_exposure != false %}
47
47
  data-track-zz-exposure="true"
48
48
  {% endif %}
49
+ data-zz-module-name="faq"
49
50
  class="faq-custom max-lg:tw-px-[20px] lg:tw-mx-auto lg:tw-w-[95.3125vw] xl:tw-w-[1220px] fade-in-box">
50
51
  {% render 'content-h2',
51
52
  title_color: section.settings.title_color,
@@ -22,6 +22,7 @@
22
22
  {% if section.settings.is_exposure != false %}
23
23
  data-track-zz-exposure="true"
24
24
  {% endif %}
25
+ close-icon-color="{{ section.settings.close_icon_color }}"
25
26
  close-btn-color="close-btn-{{ section.settings.close_btn_color }}" {% if section.settings.sheet_on_mobile %} sheet-on-mobile {% endif %} {% if section.settings.no_backdrop_close %} no-backdrop-close {% endif %} id="{{ section.settings.modal_id }}"{% unless section.settings.show_header %} no-header{% endunless %}{% unless section.settings.show_footer %} no-footer{% endunless %}>
26
27
  {% if section.settings.show_header %}
27
28
  <div slot="header" class="tw-text-[24px] tw-font-semibold">{{ section.settings.header_text }}</div>
@@ -74,6 +75,11 @@
74
75
  { "value": "white", "label": "白色" },
75
76
  { "value": "black", "label": "黑色" }
76
77
  ],
78
+ },
79
+ {
80
+ "type": "color",
81
+ "id": "close_icon_color",
82
+ "label": "叉叉颜色",
77
83
  },
78
84
  {
79
85
  "type": "checkbox",
@@ -119,6 +119,7 @@
119
119
  {% endunless %}
120
120
  {% endfor %}
121
121
  </div>
122
+ {% if section.settings.btn_text != blank %}
122
123
  <div class="tw-flex-shrink-0 tw-relative">
123
124
  <div class="cover-box tw-absolute tw-top-0 tw-left-[-50px] tw-w-[50px] tw-h-full">&nbsp;</div>
124
125
  {% render 'zz-button',
@@ -131,7 +132,7 @@
131
132
 
132
133
  %}
133
134
  </div>
134
-
135
+ {% endif %}
135
136
 
136
137
  </div>
137
138
  </div>
@@ -710,7 +710,7 @@
710
710
  {% if banner.settings.banner_name != blank %}
711
711
  data-track-zz-element="{{ banner.settings.banner_name }}"
712
712
  {% endif %}
713
- class='{{ banner.id }}-site-event tw-w-fit tw-block tw-no-underline tw-h-[48px] max-lg:tw-px-[20px] lg:tw-px-[24px] max-lg:tw-h-[36px] tw-leading-[48px] max-lg:tw-leading-[36px] tw-text-center tw-rounded-full tw-text-[16px] max-lg:tw-text-[13px] max-lg:tw-mx-auto tw-cursor-pointer'
713
+ class='{{ banner.id }}-site-event zz-banner-btn tw-w-fit tw-block tw-no-underline tw-h-[48px] max-lg:tw-px-[20px] lg:tw-px-[24px] max-lg:tw-h-[36px] tw-leading-[48px] max-lg:tw-leading-[36px] tw-text-center tw-rounded-full tw-text-[16px] max-lg:tw-text-[13px] max-lg:tw-mx-auto tw-cursor-pointer'
714
714
  style='color: {{ banner.settings.btn_color | default: 'black' }}; border: 1px solid {{ banner.settings.btn_border_color | default: 'white' }}; background: {{ banner.settings.btn_background_color | default: 'white' }}'
715
715
  >
716
716
  {{- banner.settings.btn_text -}}
@@ -722,7 +722,7 @@
722
722
  {% if banner.settings.banner_name != blank %}
723
723
  data-track-zz-element="{{ banner.settings.banner_name }}"
724
724
  {% endif %}
725
- class='{{ banner.id }}-site-event tw-w-fit tw-h-[48px] max-lg:tw-px-[20px] lg:tw-px-[24px] max-lg:tw-h-[36px] tw-leading-[48px] max-lg:tw-leading-[36px] tw-text-center tw-rounded-full tw-text-[16px] max-lg:tw-text-[13px] max-lg:tw-mx-auto tw-cursor-pointer'
725
+ class='{{ banner.id }}-site-event zz-banner-btn tw-w-fit tw-h-[48px] max-lg:tw-px-[20px] lg:tw-px-[24px] max-lg:tw-h-[36px] tw-leading-[48px] max-lg:tw-leading-[36px] tw-text-center tw-rounded-full tw-text-[16px] max-lg:tw-text-[13px] max-lg:tw-mx-auto tw-cursor-pointer'
726
726
  style='color: {{ banner.settings.btn_color | default: 'black' }}; border: 1px solid {{ banner.settings.btn_border_color | default: 'white' }}; background: {{ banner.settings.btn_background_color | default: 'white' }}'
727
727
  >
728
728
  {{- banner.settings.btn_text -}}
@@ -20,31 +20,7 @@
20
20
  "default": "#000000",
21
21
  "label": "背景色"
22
22
  },
23
- {
24
- "type": "number",
25
- "id": "pc_padding_top",
26
- "label": "PC上内边距 (Padding Top)",
27
- "default": 80
28
- },
29
- {
30
- "type": "number",
31
- "id": "pc_padding_bottom",
32
- "label": "PC下内边距 (Padding Bottom)",
33
- "default": 80
34
- },
35
- {
36
- "type": "number",
37
- "id": "mobile_padding_top",
38
- "label": "移动上内边距 (Padding Top)",
39
-
40
- "default": 40
41
- },
42
- {
43
- "type": "number",
44
- "id": "mobile_padding_bottom",
45
- "label": "移动下内边距 (Padding Bottom)",
46
- "default": 40
47
- },
23
+
48
24
  {
49
25
  "type": "color",
50
26
  "id": "collapsible_title_color",
@@ -57,6 +33,16 @@
57
33
  "label": "可折叠文字颜色",
58
34
  "default": "#B2B2B2"
59
35
  },
36
+ {
37
+ "type": "select",
38
+ "id": "mobile_style",
39
+ "label": "移动端风格",
40
+ "options": [
41
+ { "value": "left_right", "label": "左右切换" },
42
+ { "value": "tab", "label": "tab栏" },
43
+ ],
44
+ "default": "left_right"
45
+ },
60
46
  {
61
47
  "type": "select",
62
48
  "id": "collapse_button_color",
@@ -65,17 +51,45 @@
65
51
  { "value": "white", "label": "白色" },
66
52
  { "value": "black", "label": "黑色" },
67
53
  ],
68
- "default": "white"
54
+ "default": "white",
55
+ "visible_if": "{{ section.settings.mobile_style == 'left_right' }}"
69
56
  },
70
57
  {
71
58
  "type": "image_picker",
72
59
  "id": "prev_icon",
73
- "label": "轮播上一张图标 Mobile"
60
+ "label": "轮播上一张图标 Mobile",
61
+ "visible_if": "{{ section.settings.mobile_style == 'left_right' }}"
74
62
  },
75
63
  {
76
64
  "type": "image_picker",
77
65
  "id": "next_icon",
78
- "label": "轮播下一张图标 Mobile"
66
+ "label": "轮播下一张图标 Mobile",
67
+ "visible_if": "{{ section.settings.mobile_style == 'left_right' }}"
68
+ },
69
+ {
70
+ "type": "number",
71
+ "id": "pc_padding_top",
72
+ "label": "PC上内边距 (Padding Top)",
73
+ "default": 80
74
+ },
75
+ {
76
+ "type": "number",
77
+ "id": "pc_padding_bottom",
78
+ "label": "PC下内边距 (Padding Bottom)",
79
+ "default": 80
80
+ },
81
+ {
82
+ "type": "number",
83
+ "id": "mobile_padding_top",
84
+ "label": "移动上内边距 (Padding Top)",
85
+
86
+ "default": 40
87
+ },
88
+ {
89
+ "type": "number",
90
+ "id": "mobile_padding_bottom",
91
+ "label": "移动下内边距 (Padding Bottom)",
92
+ "default": 40
79
93
  },
80
94
  {
81
95
  "type": "color",
@@ -96,6 +110,7 @@
96
110
  "default": false,
97
111
  "info": "勾选后会对section模块进行曝光统计埋点, 必须填写唯一业务id"
98
112
  },
113
+
99
114
 
100
115
  ],
101
116
  "blocks": [
@@ -180,6 +195,13 @@
180
195
  "id": "heading",
181
196
  "label": "标题"
182
197
  },
198
+ {
199
+ "type": "richtext",
200
+ "id": "slide_title_mb_break",
201
+ "label": "移动端换行标题",
202
+ "info": "移动端需要控制换行时候使用,无需换行填上面",
203
+ "visible_if": "{{ section.settings.mobile_style == 'tab' }}"
204
+ },
183
205
  {
184
206
  "type": "html",
185
207
  "id": "row_content",
@@ -354,13 +376,17 @@
354
376
  {% endif %}
355
377
  </div>
356
378
 
357
- <div class='slide-box tw-pt-[20px] tw-h-[140px] tw-box-border'>
379
+ <div class='slide-box {% if section.settings.mobile_style == 'left_right' %}tw-pt-[20px] tw-h-[140px]{% else %}tw-mt-[100px] tw-h-[100px]{% endif %} tw-box-border'>
358
380
  <div class='active-box-content tw-hidden'>
359
- {% render 'zz-h5',
360
- title: collapsible_row.settings.heading,
361
- title_color: section.settings.collapsible_title_color,
362
- class_name: 'tw-text-center'
363
- %}
381
+ {% if section.settings.mobile_style == 'left_right' %}
382
+ {% render 'zz-h5',
383
+ title: collapsible_row.settings.heading,
384
+ title_color: section.settings.collapsible_title_color,
385
+ class_name: 'tw-text-center'
386
+ %}
387
+
388
+ {% endif %}
389
+
364
390
  <div class='tw-mt-[8px] lg:tw-mt-[16px]'>
365
391
  {% render 'zz-content-text',
366
392
  text: collapsible_row.settings.row_content,
@@ -377,25 +403,28 @@
377
403
  {% endfor %}
378
404
  </div>
379
405
 
380
- <!-- If we need navigation buttons -->
381
- <div class='swiper-button-prev lg:tw-hidden'>
406
+ {% if section.settings.mobile_style == 'left_right' %}
407
+ <!-- If we need navigation buttons -->
408
+ <div class='swiper-button-prev lg:tw-hidden'>
409
+ {{
410
+ section.settings.prev_icon
411
+ | image_url: width: 48
412
+ | image_tag:
413
+ alt: 'prev',
414
+ class: 'tw-w-full tw-h-full tw-object-contain'
415
+ }}
416
+ </div>
417
+ <div class='swiper-button-next lg:tw-hidden'>
382
418
  {{
383
- section.settings.prev_icon
384
- | image_url: width: 48
385
- | image_tag:
386
- alt: 'prev',
387
- class: 'tw-w-full tw-h-full tw-object-contain'
388
- }}
389
- </div>
390
- <div class='swiper-button-next lg:tw-hidden'>
391
- {{
392
- section.settings.next_icon
393
- | image_url: width: 48
394
- | image_tag:
395
- alt: 'next',
396
- class: 'tw-w-full tw-h-full tw-object-contain'
397
- }}
398
- </div>
419
+ section.settings.next_icon
420
+ | image_url: width: 48
421
+ | image_tag:
422
+ alt: 'next',
423
+ class: 'tw-w-full tw-h-full tw-object-contain'
424
+ }}
425
+ </div>
426
+
427
+ {% endif %}
399
428
 
400
429
  <!-- Pagination indicator -->
401
430
  <div class='swiper-pagination'></div>
@@ -465,7 +494,10 @@
465
494
  }
466
495
  @media screen and (max-width: 1023px) {
467
496
  #shopify-section-{{section.id}} .zz-collapse-swiper {
468
- padding-bottom: 40px;
497
+ {% if section.settings.mobile_style == 'left_right' %}
498
+ padding-bottom: 40px;
499
+ {% endif %}
500
+
469
501
  }
470
502
 
471
503
  #shopify-section-{{section.id}} .swiper-button-next,
@@ -485,16 +517,69 @@
485
517
  right: 50%;
486
518
  transform: translate({{ btn_offset }}px, 0px);
487
519
  }
488
- #shopify-section-{{section.id}} .zz-collapse-swiper .swiper-pagination-bullets .swiper-pagination-bullet {
489
- margin: 0 4px;
490
- width: 6px;
491
- height: 6px;
492
- background-color: {{ section.settings.mb_pagination_color | color_modify: 'alpha', 0.5 }};
493
- }
494
- #shopify-section-{{section.id}} .zz-collapse-swiper .swiper-pagination-bullets .swiper-pagination-bullet.swiper-pagination-bullet-active {
495
- width: 6px;
496
- background-color: {{ section.settings.mb_pagination_color }};
497
- }
520
+ {% if section.settings.mobile_style == 'tab' %}
521
+ #shopify-section-{{ section.id }} .zz-collapse-swiper .swiper-pagination-bullets {
522
+ {% if section.settings.mobile_style == 'tab' %}
523
+ bottom: 120px;
524
+ {% else %}
525
+ bottom: 85px;
526
+ {% endif %}
527
+
528
+ left: 50%;
529
+ transform: translateX(-50%);
530
+ width: calc(100% - 40px);
531
+ background: white;
532
+ border-radius: 10px;
533
+
534
+ }
535
+ #shopify-section-{{ section.id }} .swiper-pagination-horizontal {
536
+ overflow-x: auto; /* 启用横向滚动 */
537
+ white-space: nowrap; /* 不换行,强制所有子项在一行 */
538
+ -webkit-overflow-scrolling: touch; /* 移动端流畅滚动(可选) */
539
+ scrollbar-width: none; /* Firefox */
540
+ -ms-overflow-style: none; /* IE 和 Edge */
541
+ }
542
+ #shopify-section-{{ section.id }} .swiper-pagination-horizontal::-webkit-scrollbar {
543
+ display: none; /* Chrome, Safari */
544
+ }
545
+ #shopify-section-{{ section.id }} .zz-collapse-swiper .swiper-pagination-bullets .swiper-pagination-bullet {
546
+ box-sizing: content-box;
547
+ margin: 0;
548
+ padding: 16px;
549
+ height:auto;
550
+ width: fit-content;
551
+ white-space: nowrap;
552
+ font-size: 14px;
553
+ line-height: 1.2;
554
+ border-radius: 10px;
555
+ background: none;
556
+ border-top: 0;
557
+ color: #00000080;
558
+ opacity: 1;
559
+
560
+ }
561
+ #shopify-section-{{ section.id }} .zz-collapse-swiper .swiper-pagination-bullets .swiper-pagination-bullet:last-child {
562
+ margin: 0;
563
+ }
564
+ #shopify-section-{{ section.id }} .zz-collapse-swiper .swiper-pagination-bullets .swiper-pagination-bullet-active {
565
+ background:#000000;
566
+ color: #ffffff;
567
+ }
568
+
569
+ {% else %}
570
+ #shopify-section-{{section.id}} .zz-collapse-swiper .swiper-pagination-bullets .swiper-pagination-bullet {
571
+ margin: 0 4px;
572
+ width: 6px;
573
+ height: 6px;
574
+ background-color: {{ section.settings.mb_pagination_color | color_modify: 'alpha', 0.5 }};
575
+ }
576
+ #shopify-section-{{section.id}} .zz-collapse-swiper .swiper-pagination-bullets .swiper-pagination-bullet.swiper-pagination-bullet-active {
577
+ width: 6px;
578
+ background-color: {{ section.settings.mb_pagination_color }};
579
+ }
580
+
581
+ {% endif %}
582
+
498
583
  }
499
584
  @media screen and (min-width: 1024px) {
500
585
  #shopify-section-{{section.id}} {
@@ -558,27 +643,78 @@
558
643
  }
559
644
  }
560
645
 
646
+ function scrollPaginationToCenter() {
647
+ // 获取当前section
648
+ const section = document.getElementById(
649
+ 'shopify-section-{{section.id}}'
650
+ );
651
+ const paginationContainer = section.querySelector('.swiper-pagination');
652
+ const activeBullet = paginationContainer.querySelector('.swiper-pagination-bullet-active');
653
+
654
+ if (activeBullet) {
655
+ const containerWidth = paginationContainer.offsetWidth;
656
+ const bulletLeft = activeBullet.offsetLeft;
657
+ const bulletWidth = activeBullet.offsetWidth;
658
+
659
+ // 计算需要滚动的位置,使当前bullet居中
660
+ const scrollPosition = bulletLeft - (containerWidth / 2) + (bulletWidth / 2);
661
+
662
+ paginationContainer.scrollTo({
663
+ left: scrollPosition,
664
+ behavior: 'smooth'
665
+ });
666
+ }
667
+ }
561
668
 
562
669
  function initSwiper () {
670
+ // 添加标题数组
671
+ let isDesktop = window.innerWidth > 1023;
672
+ const slideTitles = [
673
+ {% for block in swiper_blocks %}
674
+ "{{ block.settings.slide_title_mb_break }}",
675
+ {% endfor %}
676
+ ];
563
677
  const swiperClassName = '.zz-collapse-swiper-{{ section.id }}';
564
- const prevSwiper = new Swiper(swiperClassName, {
565
- slidesPerView: 'auto',
566
- spaceBetween: 8,
567
- navigation: {
568
- nextEl: '.swiper-button-next',
569
- prevEl: '.swiper-button-prev',
570
- },
571
- pagination: {
572
- el: '.swiper-pagination',
573
- clickable: false,
574
- },
575
- effect: 'slide',
576
- on: {
577
- slideChangeTransitionEnd: function () {
578
- {% comment %} handleVideoOnSlideChange(); {% endcomment %}
678
+ {% if section.settings.mobile_style == 'left_right' %}
679
+ const prevSwiper = new Swiper(swiperClassName, {
680
+ slidesPerView: 'auto',
681
+ spaceBetween: 8,
682
+ navigation: {
683
+ nextEl: '.swiper-button-next',
684
+ prevEl: '.swiper-button-prev',
579
685
  },
580
- },
581
- });
686
+ pagination: {
687
+ el: '.swiper-pagination',
688
+ clickable: false,
689
+ },
690
+ effect: 'slide',
691
+ });
692
+ {% else %}
693
+ const prevSwiper = new Swiper(swiperClassName, {
694
+ slidesPerView: 'auto',
695
+ spaceBetween: 8,
696
+ navigation: false,
697
+ centeredSlides: true,
698
+ pagination: {
699
+ el: '.swiper-pagination',
700
+ clickable: true,
701
+ renderBullet: function (index, className) {
702
+ const title = slideTitles[index % slideTitles.length];
703
+ return '<div class="' + className + '">' + title + '</div>';
704
+ }
705
+ },
706
+ effect: 'fade',
707
+ on: {
708
+ slideChange: function (e) {
709
+ if (!isDesktop) {
710
+ scrollPaginationToCenter();
711
+ }
712
+ },
713
+ }
714
+ });
715
+
716
+ {% endif %}
717
+
582
718
  }
583
719
 
584
720
  initCollapse();
@@ -107,15 +107,15 @@
107
107
  }
108
108
  @media screen and (min-width: 1024px) {
109
109
  #shopify-section-{{ section.id }} .zz-banner-tab-swiper {
110
- width: 80vw;
110
+ width: 90vw;
111
111
  }
112
112
  #shopify-section-{{ section.id }} .zz-banner-tab-swiper .swiper-slide {
113
- width: 80vw;
113
+ width: 90vw;
114
114
  }
115
115
  #shopify-section-{{ section.id }} .zz-banner-tab-swiper .swiper-slide .media-box {
116
116
  position: relative;
117
- width: 80vw;
118
- height: calc(80vw / 16 * 9);
117
+ width: 90vw;
118
+ height: calc(90vw / 16 * 9);
119
119
  }
120
120
  #shopify-section-{{ section.id }} .zz-banner-tab-swiper .swiper-pagination-bullets {
121
121
  bottom: 135px;
@@ -155,14 +155,14 @@
155
155
  }
156
156
  @media screen and (min-width: 1280px) {
157
157
  #shopify-section-{{ section.id }} .zz-banner-tab-swiper {
158
- width: 1220px;
158
+ width: 1080px;
159
159
  }
160
160
  #shopify-section-{{ section.id }} .zz-banner-tab-swiper .swiper-slide {
161
- width: 1220px;
161
+ width: 1080px;
162
162
  }
163
163
  #shopify-section-{{ section.id }} .zz-banner-tab-swiper .swiper-slide .media-box {
164
164
  position: relative;
165
- width: 1220px;
165
+ width: 1080px;
166
166
  height: 686px;
167
167
  }
168
168
  #shopify-section-{{ section.id }} .zz-banner-tab-swiper .swiper-pagination-bullets {
@@ -225,7 +225,7 @@
225
225
 
226
226
  <div class='zz-swiper-container'>
227
227
  <div
228
- class='swiper zz-banner-tab-swiper zz-banner-tab-swiper-{{ section.id }} lg:tw-w-[80vw] xl:tw-w-[64vw]'
228
+ class='swiper zz-banner-tab-swiper zz-banner-tab-swiper-{{ section.id }} lg:tw-w-[90vw] xl:tw-w-[64vw]'
229
229
  >
230
230
  <div class='swiper-wrapper'>
231
231
  {% for banner in swiper_blocks %}
@@ -0,0 +1,227 @@
1
+ {% schema %}
2
+ {
3
+ "name": "VOC Section",
4
+ "class": "zz-voc-section",
5
+ "tag": "section",
6
+ "disabled_on": {
7
+ "groups": ["header", "footer"]
8
+ },
9
+ "settings": [
10
+ {
11
+ "type": "color",
12
+ "id": "bg_color",
13
+ "label": "背景色",
14
+ "default": "#ffffff"
15
+ },
16
+ {
17
+ "type": "number",
18
+ "id": "padding_top",
19
+ "label": "上间距",
20
+ "default": 20,
21
+ "info": "单位:px"
22
+ },
23
+ {
24
+ "type": "number",
25
+ "id": "padding_bottom",
26
+ "label": "下间距",
27
+ "default": 80,
28
+ "info": "单位:px"
29
+ },
30
+ {
31
+ "type": "number",
32
+ "id": "padding_top_mb",
33
+ "label": "上间距(mobile)",
34
+ "default": 16,
35
+ "info": "单位:px"
36
+ },
37
+ {
38
+ "type": "number",
39
+ "id": "padding_bottom_mb",
40
+ "label": "下间距(mobile)",
41
+ "default": 24,
42
+ "info": "单位:px"
43
+ },
44
+ ],
45
+ "blocks": [
46
+ {
47
+ "type": "comment",
48
+ "name": "comment",
49
+ "limit": 3,
50
+ "settings": [
51
+ {
52
+ "type": "select",
53
+ "id": "pc_media_pos",
54
+ "label": "图片/视频位置(pc)",
55
+ "options": [
56
+ {
57
+ "value": "top",
58
+ "label": "上"
59
+ },
60
+ {
61
+ "value": "bottom",
62
+ "label": "下"
63
+ }
64
+ ],
65
+ "default": "top"
66
+ },
67
+ {
68
+ "type": "select",
69
+ "id": "mb_media_pos",
70
+ "label": "图片/视频位置(mobile)",
71
+ "options": [
72
+ {
73
+ "value": "top",
74
+ "label": "上"
75
+ },
76
+ {
77
+ "value": "bottom",
78
+ "label": "下"
79
+ }
80
+ ],
81
+ "default": "top"
82
+ },
83
+ {
84
+ "type": "image_picker",
85
+ "id": "avatar",
86
+ "label": "头像"
87
+ },
88
+ {
89
+ "type": "text",
90
+ "id": "username",
91
+ "label": "用户名"
92
+ },
93
+ {
94
+ "type": "richtext",
95
+ "id": "account",
96
+ "label": "账号"
97
+ },
98
+ {
99
+ "type": "richtext",
100
+ "id": "content",
101
+ "label": "内容"
102
+ },
103
+ {
104
+ "type": "image_picker",
105
+ "id": "pc_image",
106
+ "label": "图片(pc)"
107
+ },
108
+ {
109
+ "type": "image_picker",
110
+ "id": "mb_image",
111
+ "label": "图片(mobile)"
112
+ },
113
+ {
114
+ "type": "video",
115
+ "id": "pc_video",
116
+ "label": "视频(pc)"
117
+ },
118
+ {
119
+ "type": "video",
120
+ "id": "mb_video",
121
+ "label": "视频(mobile)"
122
+ }
123
+ ]
124
+ }
125
+ ],
126
+ "presets": [
127
+ {
128
+ "name": "VOC 客户背书"
129
+ }
130
+ ]
131
+ }
132
+ {% endschema %}
133
+
134
+ <div class='user-spokes-section lg:tw-w-[85.3906vw] xl:tw-w-[1093px] lg:tw-mx-auto'>
135
+ <div class='max-lg:tw-px-[20px] tw-flex lg:tw-justify-between max-lg:tw-overflow-x-auto tw-gap-[20px] slow-reveal'>
136
+ {% for block in section.blocks %}
137
+ <div class='comment-box lg:tw-w-[351px] tw-flex tw-flex-col'>
138
+ <div class='comment-item lg:tw-w-[351px] lg:tw-h-[468px]'>
139
+ {% render 'zz-spoke',
140
+ bg_color: 'rgba(0,0,0,0.04)',
141
+ class_name: 'max-lg:tw-bg-[#F5F5F6]',
142
+ pc_image: block.settings.pc_image,
143
+ pc_video: block.settings.pc_video,
144
+ mb_image: block.settings.mb_image,
145
+ mb_video: block.settings.mb_video,
146
+ pc_media_pos: block.settings.pc_media_pos,
147
+ mb_media_pos: block.settings.mb_media_pos,
148
+ user_name: block.settings.username,
149
+ user_avatar: block.settings.avatar,
150
+ user_account: block.settings.account,
151
+ content: block.settings.content,
152
+ name_class: 'tw-text-black max-lg:tw-text-[10px] lg:tw-text-[14px]',
153
+ content_class: 'max-lg:tw-text-[10px] lg:tw-text-[14px] tw-text-black/70 lg:tw-text-black/60 max-lg:tw-leading-[1.2] tw-line-clamp-6 lg:tw-line-clamp-4'
154
+ %}
155
+ </div>
156
+ </div>
157
+ {% endfor %}
158
+ </div>
159
+ </div>
160
+
161
+ <style>
162
+ #shopify-section-{{section.id}} {
163
+ letter-spacing: 0;
164
+ background: {{ section.settings.bg_color }};
165
+ padding-top: {{ section.settings.padding_top_mb }}px;
166
+ padding-bottom: {{ section.settings.padding_bottom_mb }}px;
167
+ }
168
+ #shopify-section-{{section.id}} p {
169
+ margin: 0;
170
+ }
171
+ #shopify-section-{{section.id}} .zz-spoke-block-media img{
172
+ height: 100%;
173
+ }
174
+ @media screen and (max-width: 1023px) {
175
+ #shopify-section-{{section.id}} .comment-box .comment-item {
176
+ width: 168px;
177
+
178
+ }
179
+
180
+ #shopify-section-{{section.id}} .comment-box {
181
+ width: 168px;
182
+ height: 357px;
183
+ }
184
+ #shopify-section-{{section.id}} .comment-box .zz-spoke-block-media {
185
+ height: 221px;
186
+ }
187
+ #shopify-section-{{section.id}} .comment-box .zz-spoke-block-content {
188
+ box-sizing: border-box;
189
+ height: 136px;
190
+ }
191
+
192
+
193
+
194
+ }
195
+ @media (min-width: 1024px) {
196
+ #shopify-section-{{section.id}} {
197
+ padding-top: {{ section.settings.padding_top }}px;
198
+ padding-bottom: {{ section.settings.padding_bottom }}px;
199
+ }
200
+ #shopify-section-{{section.id}} .comment-box {
201
+ height: 643px;
202
+ }
203
+ #shopify-section-{{section.id}} .comment-box .zz-spoke-block-media {
204
+ height: 468px;
205
+ }
206
+ #shopify-section-{{section.id}} .comment-box .zz-spoke-block-content {
207
+ height: 175px;
208
+ }
209
+ }
210
+ @media (min-width: 1024px) and (max-width: 1280px) {
211
+ #shopify-section-{{section.id}} .user-spokes-section {
212
+ width: 85.3906vw;
213
+ }
214
+ #shopify-section-{{section.id}} .comment-box {
215
+ width: 27.4219vw;
216
+ }
217
+ #shopify-section-{{section.id}} .comment-box .comment-item {
218
+ width: 27.4219vw;
219
+ }
220
+ #shopify-section-{{section.id}} .comment-box .zz-spoke-block {
221
+ height: calc(175px + 36.5625vw);
222
+ }
223
+ #shopify-section-{{section.id}} .comment-box .zz-spoke-block-media {
224
+ height: 36.5625vw;
225
+ }
226
+ }
227
+ </style>