zz-shopify-components 0.32.0 → 0.32.1-beta.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.
@@ -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>
@@ -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
+
@@ -0,0 +1,192 @@
1
+ {% schema %}
2
+ {
3
+ "name": "Video Preview Btn",
4
+ "settings": [
5
+
6
+ {
7
+ "type": "image_picker",
8
+ "id": "btn_bg_image_pc",
9
+ "label": "按钮背景图片 PC"
10
+ },
11
+ {
12
+ "type": "image_picker",
13
+ "id": "btn_bg_image_mb",
14
+ "label": "按钮背景图片 Mobile"
15
+ },
16
+ {
17
+ "type": "number",
18
+ "id": "desktop_width",
19
+ "label": "PC端宽度",
20
+ "default": 327,
21
+ "info": "单位:px"
22
+ },
23
+ {
24
+ "type": "number",
25
+ "id": "desktop_height",
26
+ "label": "PC端高度",
27
+ "default": 327,
28
+ "info": "单位:px"
29
+ },
30
+ {
31
+ "type": "number",
32
+ "id": "mb_width",
33
+ "label": "移动端宽度",
34
+ "default": 141,
35
+ "info": "单位:px"
36
+ },
37
+ {
38
+ "type": "number",
39
+ "id": "mb_height",
40
+ "label": "移动端高度",
41
+ "default": 327,
42
+ "info": "单位:px"
43
+ },
44
+ {
45
+ "type": "checkbox",
46
+ "id": "if_position_right_bottom",
47
+ "label": "PC 定位到右下角",
48
+ "default": true
49
+ },
50
+ {
51
+ "type": "video",
52
+ "id": "small_video_pc",
53
+ "label": "预览小视频"
54
+ },
55
+ {
56
+ "type": "image_picker",
57
+ "id": "small_poster_pc",
58
+ "label": "预览小视频 封面"
59
+ },
60
+ {
61
+ "type": "video",
62
+ "id": "small_video_mb",
63
+ "label": "预览小视频移动端"
64
+ },
65
+ {
66
+ "type": "image_picker",
67
+ "id": "small_poster_mb",
68
+ "label": "预览小视频移动端 封面"
69
+ },
70
+ {
71
+ "type": "video",
72
+ "id": "video_pc",
73
+ "label": "视频"
74
+ },
75
+ {
76
+ "type": "image_picker",
77
+ "id": "poster_pc",
78
+ "label": "视频 封面"
79
+ },
80
+ {
81
+ "type": "video",
82
+ "id": "video_mb",
83
+ "label": "视频 移动端"
84
+ },
85
+ {
86
+ "type": "image_picker",
87
+ "id": "poster_mb",
88
+ "label": "视频 移动端 封面"
89
+ },
90
+
91
+ {
92
+ "type": "text",
93
+ "id": "btn_id",
94
+ "label": "按钮id",
95
+ "default": "video_preview_btn"
96
+ },
97
+
98
+
99
+ ],
100
+ "presets": [
101
+ {
102
+ "name": "Video Preview Btn"
103
+ }
104
+ ]
105
+ }
106
+ {% endschema %}
107
+
108
+
109
+ <div class="zz-video-preview tw-relative tw-rounded-[4px] lg:tw-rounded-[16px]">
110
+ {% render 'zz-video',
111
+ pc_video: block.settings.small_video_pc,
112
+ pc_poster: block.settings.small_poster_pc,
113
+ mb_video: block.settings.small_video_mb,
114
+ mb_poster: block.settings.small_poster_mb,
115
+ controls: false,
116
+ lazy: false,
117
+ class: 'tw-w-full tw-h-full small-preview-video tw-rounded-[4px] lg:tw-rounded-[16px] tw-object-cover',
118
+ autoplay: true,
119
+ loop: true
120
+ %}
121
+ {% render 'zz-img',
122
+ pc_image: block.settings.btn_bg_image_pc,
123
+ mb_image: block.settings.btn_bg_image_mb,
124
+ image_alt: block.settings.text | escape,
125
+ id: block.settings.btn_id,
126
+ class_name: 'zz-video-preview-btn tw-absolute max-lg:tw-top-1/2 max-lg:tw-left-1/2 max-lg:tw--translate-x-1/2 max-lg:tw--translate-y-1/2
127
+ lg:tw-top-[20px] lg:tw-left-[20px]',
128
+ %}
129
+
130
+ </div>
131
+
132
+ {% render 'zz-video-popup',
133
+ pc_video: block.settings.video_pc,
134
+ pc_poster: block.settings.poster_pc,
135
+ mb_video: block.settings.video_mb,
136
+ mb_poster: block.settings.poster_mb,
137
+ module_id: 'view-video-popup'
138
+ %}
139
+
140
+ <style>
141
+ #shopify-block-{{block.id}} .zz-video-preview{
142
+ width: {{ block.settings.mb_width }}px;
143
+ height: {{ block.settings.mb_height }}px;
144
+ position: relative;
145
+
146
+ }
147
+
148
+ #shopify-block-{{block.id}} .zz-video-preview-btn{
149
+ width: 101px;
150
+ height: auto;
151
+ cursor: pointer;
152
+
153
+ }
154
+ @media screen and (min-width: 1024px) {
155
+ #shopify-block-{{block.id}} .zz-video-preview{
156
+ width: {{ block.settings.desktop_width }}px;
157
+ height: {{ block.settings.desktop_height }}px;
158
+
159
+ }
160
+ #shopify-block-{{block.id}} .zz-video-preview-btn{
161
+ width: 116px;
162
+
163
+ }
164
+
165
+ {% if block.settings.if_position_right_bottom %}
166
+ #shopify-block-{{block.id}} {
167
+ position: absolute;
168
+ right: 58px;
169
+ bottom: 37px;
170
+ }
171
+ {% endif %}
172
+
173
+ }
174
+ </style>
175
+
176
+ <script>
177
+
178
+ (function () {
179
+ const block = document.getElementById(
180
+ 'shopify-block-{{block.id}}'
181
+ );
182
+ const videoPopup = block.querySelector('zz-video-popup');
183
+ const showBtns = block.querySelectorAll('.zz-video-preview-btn');
184
+ showBtns.forEach(btn => {
185
+ btn.addEventListener('click', function () {
186
+ videoPopup.togglePopup();
187
+ });
188
+ });
189
+
190
+ })();
191
+
192
+ </script>