zz-shopify-components 0.32.0 → 0.32.1-beta.1

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.
@@ -462,4 +462,20 @@ body.zz-dialog-open {
462
462
  .zz-toast-box.show {
463
463
  opacity: 1;
464
464
  transform: translateZ(0) scale(1);
465
+ }
466
+
467
+
468
+
469
+ .zz-overflow-scrollbar-hidden {
470
+ scrollbar-width: none;
471
+ /* Firefox */
472
+ -ms-overflow-style: none;
473
+ /* IE 10+ */
474
+ }
475
+
476
+ .zz-overflow-scrollbar-hidden::-webkit-scrollbar {
477
+ width: 0;
478
+ height: 0;
479
+ display: none;
480
+ /* Chrome/Safari/Edge */
465
481
  }
@@ -463,5 +463,23 @@ document.addEventListener('DOMContentLoaded', (event) => {
463
463
 
464
464
  }
465
465
 
466
+ // 处理统一的定位脚本
467
+ document.addEventListener('click', (e) => {
468
+ // data-zz-module-name
469
+ const positionTrigger = e.target.closest('[data-zz-module-target]');
470
+ if (positionTrigger) {
471
+ const selector = positionTrigger.getAttribute('data-zz-module-target');
472
+ if (selector) {
473
+ const target = document.querySelector(`[data-zz-module-name="${selector}"]`);
474
+ const headerHeight = 50;
475
+ const offsetTop = target.offsetTop - headerHeight;
476
+ window.scrollTo(0, offsetTop);
477
+
478
+ }
479
+ return;
480
+ }
481
+ });
482
+
466
483
 
467
484
  });
485
+
@@ -71,6 +71,15 @@
71
71
  padding-top: 64px;
72
72
  padding-bottom: 108px;
73
73
  }
74
+ {% if block_size <= 3 %}
75
+ #shopify-block-{{ block.id }} .swiper-button-next,
76
+ #shopify-block-{{ block.id }} .swiper-button-prev {
77
+ display: none;
78
+ }
79
+ #shopify-block-{{ block.id }} .zz-accessories-swiper .swiper-pagination-bullets {
80
+ display: none;
81
+ }
82
+ {% endif %}
74
83
 
75
84
  }
76
85
 
@@ -627,6 +627,11 @@
627
627
  {% else %}
628
628
  {% assign pc_video = block.settings.pc_background_video %}
629
629
  {% endif %}
630
+
631
+ {% if block.settings.module_id != blank %}
632
+ {% assign module_id = block.settings.module_id | append: '_video' %}
633
+ {% endif %}
634
+
630
635
  {% render 'zz-video',
631
636
  pc_video: pc_video,
632
637
  pc_poster: block.settings.pc_background_video_poster,
@@ -635,6 +640,7 @@
635
640
  lazy: lazy,
636
641
  class: 'flex-layout-video',
637
642
  autoplay: true,
643
+ module_id: module_id,
638
644
  loop: loop,
639
645
  muted: true
640
646
  %}
@@ -188,6 +188,24 @@
188
188
  "label": "移动端圆角 (px)",
189
189
  "default": 0
190
190
  },
191
+ {
192
+ "type": "checkbox",
193
+ "id": "has_background_image",
194
+ "label": "是否设置背景图片",
195
+ "default": false
196
+ },
197
+ {
198
+ "type": "image_picker",
199
+ "id": "pc_background_image",
200
+ "label": "PC端背景图片",
201
+ "visible_if": "{{ block.settings.has_background_image == true }}",
202
+ },
203
+ {
204
+ "type": "image_picker",
205
+ "id": "mobile_background_image",
206
+ "label": "移动端背景图片",
207
+ "visible_if": "{{ block.settings.has_background_image == true }}"
208
+ },
191
209
 
192
210
  {
193
211
  "type": "header",
@@ -266,7 +284,7 @@
266
284
  "type": "text",
267
285
  "id": "module_name",
268
286
  "label": "模块名称",
269
- "info": "用于定位到本模块,可多个section使用同一名称"
287
+ "info": "用于定位到本模块,可多个section/block使用同一名称"
270
288
  },
271
289
  {
272
290
  "type": "text",
@@ -591,7 +609,7 @@
591
609
  {% endif %}
592
610
 
593
611
 
594
- #shopify-block-{{ block.id }} .flex-layout-block-container {
612
+ .flex-layout-block-container-{{ block.id }} {
595
613
  box-sizing: border-box;
596
614
  width: 100%;
597
615
  display: flex;
@@ -599,12 +617,18 @@
599
617
  justify-content: {{ block.settings.mobile_justify }};
600
618
  align-items: {{ block.settings.mobile_align }};
601
619
  gap: {{ block.settings.mobile_gap }}px;
602
- background-color: {{ block.settings.background_color }};
603
620
  padding-top: {{ block.settings.mobile_padding_top }}px;
604
621
  padding-bottom: {{ block.settings.mobile_padding_bottom }}px;
605
622
  padding-left: {{ block.settings.mobile_padding_x }}px;
606
623
  padding-right: {{ block.settings.mobile_padding_x }}px;
607
624
  border-radius: {{ block.settings.mobile_border_radius }}px;
625
+ {% if block.settings.has_background_image and block.settings.mobile_background_image != blank %}
626
+ background-image: url({{ block.settings.mobile_background_image | image_url: width: 750 }});
627
+ background-size: 100% 100%;
628
+ background-repeat: no-repeat;
629
+ {%else %}
630
+ background: {{ block.settings.background_color }};
631
+ {% endif %}
608
632
  }
609
633
 
610
634
  @media (min-width: 1024px) {
@@ -614,7 +638,7 @@
614
638
  margin-top: -{{ block.settings.offset_top_pc }}px;
615
639
  }
616
640
  {% endif %}
617
- #shopify-block-{{ block.id }} .flex-layout-block-container {
641
+ .flex-layout-block-container-{{ block.id }} {
618
642
  flex-direction: {{ block.settings.pc_direction }};
619
643
  justify-content: {{ block.settings.pc_justify }};
620
644
  align-items: {{ block.settings.pc_align }};
@@ -633,11 +657,18 @@
633
657
  width: {{ block.settings.pc_lg_width }}vw;
634
658
  margin: 0 auto;
635
659
  {% endif %}
660
+
661
+ {% if block.settings.has_background_image and block.settings.pc_background_image != blank %}
662
+ background-image: url({{ block.settings.pc_background_image | image_url: width: 1800 }});
663
+ background-size: 100% 100%;
664
+ background-repeat: no-repeat;
665
+ {% endif %}
666
+
636
667
  }
637
668
  }
638
669
 
639
670
  @media (min-width: 1280px) {
640
- #shopify-block-{{ block.id }} .flex-layout-block-container {
671
+ .flex-layout-block-container-{{ block.id }} {
641
672
  {% if block.settings.pc_full_width %}
642
673
  width: 100%;
643
674
  {% else %}
@@ -658,6 +689,6 @@
658
689
  {% if block.settings.is_exposure != false %}
659
690
  data-track-zz-exposure="true"
660
691
  {% endif %}
661
- class="flex-layout-block-container {{ block.settings.self_animation }} {{ block.settings.child_animation }} {{ block.settings.custom_class }}">
692
+ class="flex-layout-block-container {{ block.settings.self_animation }} {{ block.settings.child_animation }} {{ block.settings.custom_class }} flex-layout-block-container-{{ block.id }}">
662
693
  {% content_for 'blocks' %}
663
694
  </div>
@@ -5,6 +5,7 @@
5
5
  --zz-modal-radius: {{ block.settings.radius_mobile }}px;
6
6
  --zz-modal-padding: {{ block.settings.padding_mobile }}px;
7
7
  --zz-modal-width: {{ block.settings.width_mobile }};
8
+ --zz-modal-background: {{ block.settings.bg_color }};
8
9
  }
9
10
  @media (min-width: 1024px) {
10
11
  #{{ block.settings.modal_id }} {
@@ -71,6 +72,12 @@
71
72
  { "value": "white", "label": "白色" },
72
73
  { "value": "black", "label": "黑色" }
73
74
  ],
75
+ },
76
+ {
77
+ "type": "color",
78
+ "id": "bg_color",
79
+ "default": "#ffffff",
80
+ "label": "背景色"
74
81
  },
75
82
  {
76
83
  "type": "checkbox",
@@ -80,6 +80,14 @@
80
80
  "value": "link_map",
81
81
  "label": "多国家映射"
82
82
  },
83
+ {
84
+ "value": "modal",
85
+ "label": "弹窗"
86
+ },
87
+ {
88
+ "value": "position_to_module",
89
+ "label": "定位到某个模块"
90
+ }
83
91
  ],
84
92
  "default": "link",
85
93
  "visible_if": "{{ block.settings.has_link == true }}"
@@ -97,6 +105,25 @@
97
105
  "info": "国家对应链接的表,国家即是国家选择器上显示的字段,国家和路由之间用冒号隔开( 冒号后要加空格)。国家之间换行,“default”为其他未写的默认的链接 EG: Canada: https://hoverair.com/ default: https://hoverair.com/ ",
98
106
  "visible_if": "{{ block.settings.function_type == 'link_map' and block.settings.has_link == true }}"
99
107
  },
108
+ {
109
+ "type": "text",
110
+ "id": "position_module_id",
111
+ "label": "定位到模块的id",
112
+ "visible_if": "{{ block.settings.function_type == 'position_to_module' and block.settings.has_link == true }}"
113
+ },
114
+ {
115
+ "type": "text",
116
+ "id": "modal_id",
117
+ "label": "按钮触发modal的id",
118
+ "visible_if": "{{ block.settings.function_type == 'modal' and block.settings.has_link == true }}"
119
+ },
120
+ {
121
+ "type": "text",
122
+ "id": "btn_id",
123
+ "label": "业务id",
124
+ "info": "按钮的唯一id,用于代码控制、埋点统计等"
125
+ },
126
+
100
127
 
101
128
  ],
102
129
  "presets": [
@@ -112,12 +139,15 @@
112
139
 
113
140
  {% assign link_class = 'zz-link-' | append: block.id %}
114
141
  {% assign image_class = 'ratio-image ' | append: link_class %}
142
+ {% assign modalTarget = block.settings.modal_id | prepend: '#' %}
115
143
 
116
144
  {% render 'zz-img',
117
145
  pc_image: block.settings.desktop_image,
118
146
  mb_image: block.settings.mobile_image,
119
147
  image_alt: block.settings.alt | escape,
120
148
  class_name: image_class,
149
+ modal_target: modalTarget,
150
+ module_target: block.settings.position_module_id,
121
151
  %}
122
152
 
123
153
  <style>
@@ -160,7 +190,7 @@
160
190
  }
161
191
  })
162
192
  </script>
163
- {% else %}
193
+ {% elsif block.settings.function_type == 'link' %}
164
194
  <script>
165
195
  document.addEventListener('DOMContentLoaded', (event) => {
166
196
 
@@ -106,6 +106,40 @@
106
106
  "id": "alt",
107
107
  "label": "alt",
108
108
  "default": "image loading"
109
+ },
110
+ {
111
+ "type": "checkbox",
112
+ "id": "use_margin",
113
+ "label": "是否设置上下外边距",
114
+ "default": false
115
+ },
116
+ {
117
+ "type": "number",
118
+ "id": "mobile_margin_top",
119
+ "label": "移动上外边距 (Margin Top)",
120
+ "default": 0,
121
+ "visible_if": "{{ block.settings.use_margin == true }}"
122
+ },
123
+ {
124
+ "type": "number",
125
+ "id": "mobile_margin_bottom",
126
+ "label": "移动下外边距 (Margin Bottom)",
127
+ "default": 0,
128
+ "visible_if": "{{ block.settings.use_margin == true }}"
129
+ },
130
+ {
131
+ "type": "number",
132
+ "id": "pc_margin_top",
133
+ "label": "PC上外边距 (Margin Top)",
134
+ "default": 0,
135
+ "visible_if": "{{ block.settings.use_margin == true }}"
136
+ },
137
+ {
138
+ "type": "number",
139
+ "id": "pc_margin_bottom",
140
+ "label": "PC下外边距 (Margin Bottom)",
141
+ "default": 0,
142
+ "visible_if": "{{ block.settings.use_margin == true }}"
109
143
  },
110
144
  {
111
145
  "type": "checkbox",
@@ -180,6 +214,13 @@
180
214
  }
181
215
 
182
216
  @media screen and (max-width: 1023px) {
217
+ {% if block.settings.use_margin == true %}
218
+ #shopify-block-{{ block.id }} {
219
+ margin-top: {{ block.settings.mobile_margin_top }}px;
220
+ margin-bottom: {{ block.settings.mobile_margin_bottom }}px;
221
+ }
222
+ {% endif %}
223
+
183
224
  #shopify-block-{{ block.id }} .responsive-width-container img {
184
225
  aspect-ratio: {{ block.settings.mobile_aspect_ratio }};
185
226
  }
@@ -202,6 +243,12 @@
202
243
 
203
244
  }
204
245
  @media screen and (min-width: 1024px) {
246
+ {% if block.settings.use_margin == true %}
247
+ #shopify-block-{{ block.id }} {
248
+ margin-top: {{ block.settings.pc_margin_top }}px;
249
+ margin-bottom: {{ block.settings.pc_margin_bottom }}px;
250
+ }
251
+ {% endif %}
205
252
  #shopify-block-{{ block.id }} .responsive-width-container img {
206
253
  aspect-ratio: {{ block.settings.desktop_aspect_ratio }};
207
254
  }
@@ -94,8 +94,25 @@
94
94
  "label": "文字颜色",
95
95
  "default": "#000000"
96
96
  },
97
-
98
-
97
+ {
98
+ "type": "text",
99
+ "id": "module_id",
100
+ "label": "唯一业务id",
101
+ "info": "需要唯一不要与其他模块重复,用户定位、埋点统计、代码隐藏控制等"
102
+ },
103
+ {
104
+ "type": "checkbox",
105
+ "id": "is_exposure",
106
+ "label": "是否曝光统计",
107
+ "default": false,
108
+ "info": "勾选后会对Block模块进行曝光统计埋点, 必须填写唯一业务id"
109
+ },
110
+ {
111
+ "type": "text",
112
+ "id": "module_name",
113
+ "label": "模块名称",
114
+ "info": "用于定位到本模块,可多个section/block使用同一名称"
115
+ },
99
116
  ],
100
117
  "presets": [
101
118
  {
@@ -108,7 +125,16 @@
108
125
  }
109
126
  {% endschema %}
110
127
 
111
- <div class="sticky-section">
128
+ <div
129
+ class="scroll-block-scroll-animate"
130
+ {% if block.settings.module_id != blank %}
131
+ data-track-zz-block="{{ block.settings.module_id }}"
132
+ {% endif %}
133
+ {% if block.settings.is_exposure != false %}
134
+ data-track-zz-exposure="true"
135
+ {% endif %}
136
+ {% if block.settings.module_name != blank %}data-zz-module-name="{{ block.settings.module_name }}"{% endif %}
137
+ >
112
138
  <div class="image-container tw-relative tw-w-full tw-h-full">
113
139
  <div class="zz-scroll-animate-bg-image tw-w-full tw-h-full">
114
140
  {% render 'zz-img',
@@ -172,7 +198,7 @@
172
198
  position: relative;
173
199
  background-color: {{ block.settings.background_color }};
174
200
  }
175
- #shopify-block-{{ block.id }} .sticky-section {
201
+ #shopify-block-{{ block.id }} .scroll-block-scroll-animate {
176
202
  position: sticky;
177
203
  width: 100%;
178
204
  top: 0;
@@ -0,0 +1,156 @@
1
+ <style>
2
+ @media screen and (max-width: 1023px) {
3
+ #shopify-block-{{block.id}} {
4
+ width: calc(100% - 40px);
5
+ box-sizing: border-box;
6
+ }
7
+ #shopify-block-{{block.id}} .image-video-box {
8
+ border-radius: 12px;
9
+ }
10
+ }
11
+ @media screen and (min-width: 1024px) {
12
+ #shopify-block-{{block.id}} {
13
+ width: 500px;
14
+ }
15
+ #shopify-block-{{block.id}} .image-video-box {
16
+ border-radius: 18px;
17
+ }
18
+
19
+ }
20
+ @media screen and (min-width: 1280px) {
21
+ #shopify-block-{{block.id}} {
22
+ width: 631px;
23
+
24
+ }
25
+
26
+ }
27
+
28
+ #shopify-block-{{block.id}}.swiper-slide-active .active-box-content {
29
+ display: block !important;
30
+ }
31
+ </style>
32
+
33
+ {% assign media_class = 'zz-link-' | append: block.id %}
34
+
35
+
36
+ <div class='media-box tw-relative banner-item {{ media_class }}'>
37
+ {% render 'zz-h6',
38
+ title: block.settings.heading,
39
+ title_color: block.settings.title_color,
40
+ class_name: 'media-box-title tw-text-center max-lg:tw-hidden tw-absolute tw-top-[20px] tw-left-[20px]'
41
+ %}
42
+ {% if block.settings.video_pc != blank %}
43
+ {% if block.settings.video_url_pc != blank %}
44
+ {% assign pc_video = block.settings.video_url_pc %}
45
+ {% else %}
46
+ {% assign pc_video = block.settings.video_pc %}
47
+ {% endif %}
48
+ {% render 'zz-video',
49
+ pc_video: pc_video,
50
+ pc_poster: block.settings.poster_pc,
51
+ mb_video: block.settings.video_mb,
52
+ mb_poster: block.settings.poster_mb,
53
+ lazy: true,
54
+ class: 'image-video-box tw-w-full tw-h-auto ',
55
+ autoplay: false,
56
+ muted: true
57
+ %}
58
+ {% else %}
59
+ {%
60
+ render 'zz-img',
61
+ pc_image: block.settings.poster_pc,
62
+ mb_image: block.settings.poster_mb,
63
+ image_alt: block.settings.heading | escape,
64
+ class_name: 'image-video-box',
65
+ %}
66
+ {% endif %}
67
+ </div>
68
+
69
+
70
+ <div class='active-box-content max-lg:tw-mt-[20px]'>
71
+ {% render 'zz-h5',
72
+ title: block.settings.heading,
73
+ title_color: block.settings.title_color,
74
+ class_name: 'tw-text-center lg:tw-hidden !tw-text-[16px]'
75
+ %}
76
+ <div class='tw-mt-[8px] lg:tw-mt-[16px]'>
77
+ {% render 'zz-content-text',
78
+ text: block.settings.row_content,
79
+ mb_text: block.settings.row_content,
80
+ pc_font_size: 16,
81
+ mobile_font_size: 12,
82
+ text_color: block.settings.content_color,
83
+ class_name: 'tw-text-left',
84
+ %}
85
+ </div>
86
+ </div>
87
+
88
+
89
+ {% schema %}
90
+ {
91
+ "name": "Swiper Title In Item",
92
+ "class": "zz-swiper-title-in-item",
93
+ "settings": [
94
+ {
95
+ "type": "text",
96
+ "id": "video_url_pc",
97
+ "label": "Video url PC",
98
+ "info": "使用cdn视频时,填写视频url。防止大屏幕视频模糊"
99
+ },
100
+ {
101
+ "type": "video",
102
+ "id": "video_pc",
103
+ "label": "Video"
104
+ },
105
+ {
106
+ "type": "image_picker",
107
+ "id": "poster_pc",
108
+ "label": "Poster"
109
+ },
110
+ {
111
+ "type": "video",
112
+ "id": "video_mb",
113
+ "label": "Video(Mobile)"
114
+ },
115
+ {
116
+ "type": "image_picker",
117
+ "id": "poster_mb",
118
+ "label": "Poster(Mobile)"
119
+ },
120
+ {
121
+ "type": "text",
122
+ "id": "heading",
123
+ "label": "标题"
124
+ },
125
+ {
126
+ "type": "color",
127
+ "id": "title_color",
128
+ "default": "#000000",
129
+ "label": "标题颜色"
130
+ },
131
+ {
132
+ "type": "richtext",
133
+ "id": "row_content",
134
+ "label": "description"
135
+ },
136
+ {
137
+ "type": "color",
138
+ "id": "content_color",
139
+ "default": "#B2B2B2",
140
+ "label": "内容颜色"
141
+ },
142
+ ],
143
+ "presets": [
144
+ {
145
+ "name": "Swiper Title In Item",
146
+ "category": "Swiper Item Block"
147
+ },
148
+ {
149
+ "name": "标题内部轮播-Item",
150
+ "category": "Swiper Item Block"
151
+ }
152
+ ]
153
+ }
154
+ {% endschema %}
155
+
156
+
@@ -53,6 +53,11 @@
53
53
  "id": "text_gradient",
54
54
  "label": "文字渐变 (可选)"
55
55
  },
56
+ {
57
+ "type": "color",
58
+ "id": "text_color_strong",
59
+ "label": "重点颜色(B 加粗颜色)可选",
60
+ },
56
61
  {
57
62
  "type": "header",
58
63
  "content": "💻 PC 样式设置"
@@ -297,4 +302,14 @@
297
302
  }
298
303
  {% endif %}
299
304
 
305
+ #shopify-block-{{ block.id }} .title-block {
306
+ overflow-wrap: break-word;
307
+ }
308
+ #shopify-block-{{ block.id }} .title-block strong {
309
+ font-weight: {{ block.settings.pc_font_weight_custom | default: '700' }};
310
+ {% if block.settings.text_color_strong %}
311
+ color: {{ block.settings.text_color_strong }};
312
+ {% endif %}
313
+ }
314
+
300
315
  </style>
@@ -17,6 +17,16 @@
17
17
  "type": "image_picker",
18
18
  "id": "poster_pc",
19
19
  "label": "视频 封面"
20
+ },
21
+ {
22
+ "type": "video",
23
+ "id": "video_mb",
24
+ "label": "视频 移动端"
25
+ },
26
+ {
27
+ "type": "image_picker",
28
+ "id": "poster_mb",
29
+ "label": "视频 移动端 封面"
20
30
  },
21
31
  {
22
32
  "type": "select",
@@ -73,10 +83,49 @@
73
83
  }
74
84
  {% endschema %}
75
85
 
76
- {% render 'zz-video-button',
77
- video: block.settings.video_pc,
78
- poster: block.settings.poster_pc,
79
- color: block.settings.color,
80
- text: block.settings.text,
81
- size: block.settings.size
82
- %}
86
+ {% assign video_mb = block.settings.video_mb %}
87
+ {% assign poster_mb = block.settings.poster_mb %}
88
+ {% if block.settings.video_mb == blank %}
89
+ {% assign video_mb = block.settings.video_pc %}
90
+ {% endif %}
91
+ {% if block.settings.poster_mb == blank %}
92
+ {% assign poster_mb = block.settings.poster_pc %}
93
+ {% endif %}
94
+
95
+ {% render 'zz-video-popup',
96
+ pc_video: block.settings.video_pc,
97
+ pc_poster: block.settings.poster_pc,
98
+ mb_video: video_mb,
99
+ mb_poster: poster_mb,
100
+ module_id: 'video-btn'
101
+ %}
102
+
103
+ {% render 'zz-button',
104
+ type: 'default',
105
+ color: block.settings.color,
106
+ text: block.settings.text,
107
+ size: block.settings.size,
108
+ backdrop_filter: true,
109
+ class_name: 'zz-video-btn',
110
+ icon: '<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
111
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M13.635 6.42979C14.5112 6.91507 14.5112 8.08492 13.635 8.57021L6.84517 12.331C5.94149 12.8315 4.79058 12.232 4.79058 11.2608L4.79058 3.73925C4.79058 2.768 5.94148 2.16851 6.84517 2.66904L13.635 6.42979Z" fill="white"/>
112
+ </svg>
113
+ '
114
+ %}
115
+ <script>
116
+
117
+ (function () {
118
+ const block = document.getElementById(
119
+ 'shopify-block-{{block.id}}'
120
+ );
121
+ const videoPopup = block.querySelector('zz-video-popup');
122
+ const showBtns = block.querySelectorAll('.zz-video-btn');
123
+ showBtns.forEach(btn => {
124
+ btn.addEventListener('click', function () {
125
+ videoPopup.togglePopup();
126
+ });
127
+ });
128
+
129
+ })();
130
+
131
+ </script>