zz-shopify-components 0.0.21 → 0.0.24-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.
@@ -436,15 +436,15 @@
436
436
  }
437
437
  {% if block.settings.full_screen_bg %}
438
438
  #shopify-block-{{ block.id }} {
439
- width: 100vw;
440
- height: 100vh;
439
+ width: 100%;
440
+ height: 100%;
441
441
  }
442
442
  #shopify-block-{{ block.id }} .flex-layout-image {
443
- width: 100vw;
443
+ width: 100%;
444
444
  height: 100vh;
445
445
  }
446
446
  #shopify-block-{{ block.id }} .flex-layout-video {
447
- width: 100vw;
447
+ width: 100%;
448
448
  height: 100vh;
449
449
  object-fit: cover;
450
450
  object-position: center;
@@ -5,14 +5,14 @@
5
5
  <style>
6
6
  #shopify-block-{{block.id}} {
7
7
  background: {{ block.settings.bg_color }};
8
- width: 100vw;
8
+ width: 100%;
9
9
  height: 100vh;
10
10
  box-sizing: border-box;
11
11
  overflow: hidden;
12
12
  position: relative;
13
13
  }
14
14
  #shopify-block-{{block.id}} .zz-full-screen-swiper {
15
- width: 100vw;
15
+ width: 100%;
16
16
  height: 100vh;
17
17
  box-sizing: border-box;
18
18
  overflow: hidden;
@@ -0,0 +1,194 @@
1
+ <style>
2
+ @media screen and (max-width: 750px) {
3
+ #shopify-block-{{block.id}} {
4
+ width: calc(100% - 72px);
5
+ box-sizing: border-box;
6
+ transform: translateX(-18px);
7
+ }
8
+ }
9
+ @media screen and (min-width: 750px) {
10
+ #shopify-block-{{block.id}} {
11
+ width: 318px;
12
+ }
13
+ }
14
+
15
+ #shopify-block-{{block.id}} .media-box {
16
+ {% if block.settings.has_link %}
17
+ cursor: pointer;
18
+ {% endif %}
19
+ }
20
+
21
+ </style>
22
+
23
+ {% assign media_class = 'zz-link-' | append: block.id %}
24
+
25
+ <div class='media-box banner-item {{ media_class }} max-md:tw-rounded-[12px] md:tw-rounded-[16px]'>
26
+ {% if block.settings.video_pc != blank %}
27
+ {% if block.settings.video_url_pc != blank %}
28
+ {% assign pc_video = block.settings.video_url_pc %}
29
+ {% else %}
30
+ {% assign pc_video = block.settings.video_pc %}
31
+ {% endif %}
32
+ {% render 'zz-video-md',
33
+ pc_video: pc_video,
34
+ pc_poster: block.settings.poster_pc,
35
+ mb_video: block.settings.video_mb,
36
+ mb_poster: block.settings.poster_mb,
37
+ lazy: true,
38
+ class: 'image-video-box tw-w-full tw-h-auto max-md:tw-rounded-[12px] md:tw-rounded-[16px]',
39
+ autoplay: true,
40
+ muted: true,
41
+ loop: true
42
+ %}
43
+ {% else %}
44
+ {%
45
+ render 'zz-img-md',
46
+ pc_image: block.settings.poster_pc,
47
+ mb_image: block.settings.poster_mb,
48
+ image_alt: block.settings.heading | escape,
49
+ class_name: 'image-video-box max-md:tw-rounded-[12px] md:tw-rounded-[16px]',
50
+ %}
51
+ {% endif %}
52
+ </div>
53
+ {% if block.settings.has_title_and_content %}
54
+ <div class='active-box-content md:tw-text-[20px] max-md:tw-text-[17px] max-md:tw-mt-[20px] md:tw-mt-[24px]'>
55
+ <div class="tw-text-left tw-font-bold max-md:tw-text-[17px] md:tw-text-[20px]" style="color: {{ block.settings.title_color }};">
56
+ {{ block.settings.heading }}
57
+ </div>
58
+ <div class='tw-mt-[12px] max-md:tw-text-[12px] md:tw-text-[14px] tw-leading-[1.5]' style="color: {{ block.settings.content_color }};">
59
+ {{ block.settings.row_content }}
60
+ </div>
61
+ </div>
62
+
63
+ {% endif %}
64
+
65
+ {% schema %}
66
+ {
67
+ "name": "ZZ Video Img Item",
68
+ "class": "zz-video-img-item",
69
+ "settings": [
70
+ {
71
+ "type": "text",
72
+ "id": "video_url_pc",
73
+ "label": "Video url PC",
74
+ "info": "使用cdn视频时,填写视频url。防止大屏幕视频模糊"
75
+ },
76
+ {
77
+ "type": "video",
78
+ "id": "video_pc",
79
+ "label": "Video"
80
+ },
81
+ {
82
+ "type": "image_picker",
83
+ "id": "poster_pc",
84
+ "label": "Poster"
85
+ },
86
+ {
87
+ "type": "video",
88
+ "id": "video_mb",
89
+ "label": "Video(Mobile)"
90
+ },
91
+ {
92
+ "type": "image_picker",
93
+ "id": "poster_mb",
94
+ "label": "Poster(Mobile)"
95
+ },
96
+ {
97
+ "type": "checkbox",
98
+ "id": "has_title_and_content",
99
+ "label": "是否有标题与内容",
100
+ "default": true
101
+ },
102
+ {
103
+ "type": "text",
104
+ "id": "heading",
105
+ "label": "标题",
106
+ "visible_if": "{{ block.settings.has_title_and_content == true }}"
107
+ },
108
+ {
109
+ "type": "color",
110
+ "id": "title_color",
111
+ "default": "#ffffff",
112
+ "label": "标题颜色",
113
+ "visible_if": "{{ block.settings.has_title_and_content == true }}"
114
+ },
115
+ {
116
+ "type": "richtext",
117
+ "id": "row_content",
118
+ "label": "description",
119
+ "visible_if": "{{ block.settings.has_title_and_content == true }}"
120
+ },
121
+ {
122
+ "type": "color",
123
+ "id": "content_color",
124
+ "default": "#B2B2B2",
125
+ "label": "内容颜色",
126
+ "visible_if": "{{ block.settings.has_title_and_content == true }}"
127
+ },
128
+ {
129
+ "type": "checkbox",
130
+ "id": "has_link",
131
+ "label": "是否有链接",
132
+ "default": false
133
+ },
134
+ {
135
+ "type": "select",
136
+ "id": "function_type",
137
+ "label": "功能类型",
138
+ "options": [
139
+ {
140
+ "value": "link",
141
+ "label": "链接"
142
+ },
143
+ {
144
+ "value": "link_map",
145
+ "label": "多国家映射"
146
+ }
147
+ ],
148
+ "default": "link",
149
+ "visible_if": "{{ block.settings.has_link == true }}"
150
+ },
151
+ {
152
+ "type": "url",
153
+ "id": "url",
154
+ "label": "链接",
155
+ "visible_if": "{{ block.settings.function_type == 'link' and block.settings.has_link == true }}"
156
+ },
157
+ {
158
+ "type": "textarea",
159
+ "id": "links",
160
+ "label": "Sites Link Map",
161
+ "info": "国家对应链接的表,国家即是国家选择器上显示的字段,国家和路由之间用冒号隔开( 冒号后要加空格)。国家之间换行,“default”为其他未写的默认的链接 EG: Canada: https://hoverair.com/ default: https://hoverair.com/ ",
162
+ "visible_if": "{{ block.settings.function_type == 'link_map' and block.settings.has_link == true }}"
163
+ }
164
+ ],
165
+ "presets": [
166
+ {
167
+ "name": "ZZ Video Img Item"
168
+ },
169
+ ]
170
+ }
171
+ {% endschema %}
172
+
173
+ {% if block.settings.has_link %}
174
+ <script>
175
+ document.addEventListener('DOMContentLoaded', (event) => {
176
+ const btn = document.getElementsByClassName('{{ media_class }}')
177
+ if(btn && btn[0]) {
178
+ {% if block.settings.function_type == 'link_map' %}
179
+ if(window.bindSiteJump) {
180
+ bindSiteJump(btn[0], {{ block.settings.links | json }})
181
+ }
182
+ {% else %}
183
+ // 监听点击事件
184
+ btn[0].addEventListener('click', (event) => {
185
+ event.preventDefault();
186
+ window.location.href = '{{ block.settings.url }}';
187
+ })
188
+ {% endif %}
189
+ }
190
+
191
+ })
192
+ </script>
193
+ {% endif %}
194
+
@@ -0,0 +1,165 @@
1
+ {% assign block_size = block.blocks.size %}
2
+
3
+
4
+
5
+ <style>
6
+ #shopify-block-{{block.id}} {
7
+ background: {{ block.settings.bg_color }};
8
+ width: 100%;
9
+
10
+ box-sizing: border-box;
11
+ overflow: hidden;
12
+ position: relative;
13
+ }
14
+ #shopify-block-{{block.id}} .zz-video-img-list-swiper {
15
+ width: 100%;
16
+ box-sizing: border-box;
17
+ overflow: hidden;
18
+ height: fit-content;
19
+ position: relative;
20
+ letter-spacing: 0;
21
+ }
22
+
23
+
24
+ #shopify-block-{{block.id}} .swiper-button-next:after,
25
+ #shopify-block-{{block.id}} .swiper-button-prev:after {
26
+ display: none;
27
+ }
28
+
29
+ @media screen and (max-width: 750px) {
30
+ #shopify-block-{{block.id}} .swiper-button-next,
31
+ #shopify-block-{{block.id}} .swiper-button-prev {
32
+ display: none;
33
+ }
34
+ }
35
+ @media screen and (min-width: 750px) {
36
+
37
+
38
+ #shopify-block-{{block.id}} .swiper-button-next,
39
+ #shopify-block-{{block.id}} .swiper-button-prev {
40
+ width: 48px;
41
+ height: 48px;
42
+ }
43
+ #shopify-block-{{block.id}} .swiper-button-prev {
44
+ left: 20px;
45
+ top: 50%;
46
+ right: unset;
47
+ transform:translateY(-50%);
48
+ }
49
+ #shopify-block-{{block.id}} .swiper-button-next {
50
+ right: 20px;
51
+ left: unset;
52
+ top: 50%;
53
+ transform:translateY(-50%);
54
+ }
55
+ #shopify-block-{{block.id}} .swiper-button-next.swiper-button-disabled, #shopify-block-{{block.id}} .swiper-button-prev.swiper-button-disabled {
56
+ display: none;
57
+ }
58
+
59
+ }
60
+
61
+ </style>
62
+
63
+
64
+
65
+ <div
66
+ class='zz-video-img-list-swiper zz-video-img-list-swiper-{{ block.id }}'
67
+ >
68
+ <div class='zz-swiper-wrapper swiper-wrapper'>
69
+ {% content_for 'blocks' %}
70
+ </div>
71
+
72
+ <!-- If we need navigation buttons -->
73
+ <div class='swiper-button-prev {% if block_size <= 3 %} tw-hidden {% endif %} max-md:tw-hidden'>
74
+
75
+ {% render 'zz-prev-next-blur-icon', type: 'prev', color_type: block.settings.prev_next_type %}
76
+ </div>
77
+ <div class='swiper-button-next {% if block_size <= 3 %} tw-hidden {% endif %} max-md:tw-hidden'>
78
+ {% render 'zz-prev-next-blur-icon', type: 'next', color_type: block.settings.prev_next_type %}
79
+ </div>
80
+
81
+ </div>
82
+
83
+ <script>
84
+
85
+ document.addEventListener('DOMContentLoaded', function () {
86
+ const videoNum = {{ block_size }};
87
+ const block = document.getElementById(
88
+ 'shopify-block-{{block.id}}'
89
+ );
90
+ let isDesktop = window.innerWidth > 750;
91
+ const swiperWrapper = block.querySelector('.zz-swiper-wrapper');
92
+ // 获取当前 swiper-wrapper 下面 所有 第一层 div
93
+ const swiperSlides = swiperWrapper.querySelectorAll(':scope > div');
94
+ // 给每个 swiper-slide 添加 class swiper-slide
95
+ swiperSlides.forEach(slide => {
96
+ slide.classList.add('swiper-slide');
97
+ });
98
+
99
+ const prevIcon = block.querySelector('.swiper-button-prev');
100
+ const nextIcon = block.querySelector('.swiper-button-next');
101
+
102
+ let progressTimer = null;
103
+ const swiperClassName = '.zz-video-img-list-swiper-{{ block.id }}';
104
+ const videoImgListSwiper = new Swiper(swiperClassName, {
105
+ slidesPerView: "auto",
106
+ initialSlide: isDesktop ? 1 : 0,
107
+ centeredSlides: true,
108
+ spaceBetween: isDesktop ? 24 : 8,
109
+ navigation: {
110
+ nextEl: '.swiper-button-next',
111
+ prevEl: '.swiper-button-prev',
112
+ },
113
+ effect: 'slide',
114
+ on: {
115
+ slideChangeTransitionEnd: function (e) {
116
+ console.log('slideChangeTransitionEnd', e.activeIndex);
117
+ {% comment %} if (e.activeIndex < 1) {
118
+ videoImgListSwiper.slideTo(videoNum - 1, 0);
119
+ } else if(e.activeIndex > videoNum - 1) {
120
+ videoImgListSwiper.slideTo(0, 0);
121
+ } else {
122
+
123
+ } {% endcomment %}
124
+
125
+ },
126
+ }
127
+ });
128
+ });
129
+ </script>
130
+
131
+ {% schema %}
132
+ {
133
+ "name": "Full Screen Swiper",
134
+ "class": "zz-video-img-list-swiper-block",
135
+ "settings": [
136
+ {
137
+ "type": "color",
138
+ "id": "bg_color",
139
+ "default": "#000000",
140
+ "label": "背景色"
141
+ },
142
+
143
+ {
144
+ "type": "select",
145
+ "id": "prev_next_type",
146
+ "label": "prev next 颜色",
147
+ "options": [
148
+ { "value": "dark", "label": "黑色" },
149
+ { "value": "light", "label": "白色" },
150
+ ],
151
+ "default": "light"
152
+ },
153
+ ],
154
+ "blocks": [
155
+ {
156
+ "type": "zz-video-img-item",
157
+ }
158
+ ],
159
+ "presets": [
160
+ {
161
+ "name": "ZZ Video Img List",
162
+ },
163
+ ]
164
+ }
165
+ {% endschema %}
@@ -45,7 +45,7 @@
45
45
  #shopify-block-{{block.id}} .swiper-button-prev:after {
46
46
  display: none;
47
47
  }
48
- #shopify-section-{{section.id}} .swiper-button-next.swiper-button-disabled, #shopify-section-{{section.id}} .swiper-button-prev.swiper-button-disabled {
48
+ #shopify-block-{{block.id}} .swiper-button-next.swiper-button-disabled, #shopify-block-{{block.id}} .swiper-button-prev.swiper-button-disabled {
49
49
  opacity: 0.5;
50
50
  }
51
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zz-shopify-components",
3
- "version": "0.0.21",
3
+ "version": "0.0.24-beta.0",
4
4
  "description": "Reusable Shopify components for theme projects",
5
5
  "keywords": [
6
6
  "shopify",
@@ -335,7 +335,9 @@
335
335
  width: 100%;
336
336
  background-color: {{ section.settings.background_color }};
337
337
  }
338
-
338
+ body {
339
+ overflow-x: hidden;
340
+ }
339
341
  #shopify-section-{{ section.id }} .zz-navigation-mobile-tab {
340
342
 
341
343
  }
@@ -0,0 +1,44 @@
1
+ {% comment %}
2
+ pc_image: pc 端图片
3
+ mb_image: 移动端图片
4
+ image_alt: 图片描述
5
+ class_name: 增加类名
6
+ close_lazy: 是否关闭懒加载 true 关闭 false 开启
7
+ pc_width: pc 端宽度, 做图片尺寸优化
8
+ mb_width: 移动端宽度, 做图片尺寸优化
9
+ {% endcomment %}
10
+ {%- assign pc_width = pc_width | default: 1800 -%}
11
+ {%- assign mb_width = mb_width | default: 800 -%}
12
+
13
+ {%- assign pc_classes = class_name | append: ' max-md:tw-hidden tw-w-full tw-h-auto tw-object-cover' -%}
14
+ {%- assign mb_classes = class_name | append: ' md:tw-hidden tw-w-full tw-h-auto tw-object-cover' -%}
15
+
16
+ {%- if close_lazy == true -%}
17
+ {%- assign lazy_load = 'eager' -%}
18
+ {%- else -%}
19
+ {%- assign lazy_load = 'lazy' -%}
20
+ {%- endif -%}
21
+
22
+ {%- if pc_image -%}
23
+ {{
24
+ pc_image
25
+ | image_url: width: pc_width
26
+ | image_tag:
27
+ alt: image_alt,
28
+ class: pc_classes,
29
+ widths: '800, 1000, 1200, 1500, 1800 2000',
30
+ loading: lazy_load
31
+ }}
32
+ {%- endif -%}
33
+ {%- if mb_image -%}
34
+ {{
35
+ mb_image
36
+ | image_url: width: mb_width
37
+ | image_tag:
38
+ alt: image_alt,
39
+ class: mb_classes,
40
+ widths: '400, 600, 800',
41
+ loading: lazy_load
42
+ }}
43
+ {%- endif -%}
44
+
@@ -0,0 +1,36 @@
1
+ {% comment %}
2
+ type: 类型 prev | next
3
+ color_type: 颜色类型 dark | light
4
+ class_name: 增加类名
5
+ {% endcomment %}
6
+ {% if type == 'prev' %}
7
+ <div class="tw-cursor-pointer {% if color_type == 'light' %} tw-bg-white/20 {% else %} tw-bg-black/20 {% endif %} tw-backdrop-blur-[10px] tw-rounded-[50%] max-lg:tw-w-[36px] max-lg:tw-h-[36px] lg:tw-w-[48px] lg:tw-h-[48px] tw-flex tw-justify-center tw-items-center">
8
+ <div class="lg:tw-w-[24px] lg:tw-h-[24px] tw-w-[18px] tw-h-[18px]">
9
+ {% if color_type == 'light' %}
10
+ <svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
11
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7 12L14.0711 4.92893L14.0608 7.11487L9.17571 12L14.0711 16.8718L14.0711 19.0711L7 12Z" fill="white"/>
12
+ </svg>
13
+ {% else %}
14
+ <svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
15
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7 12L14.0711 4.92893L14.0608 7.11487L9.17571 12L14.0711 16.8718L14.0711 19.0711L7 12Z" fill="black"/>
16
+ </svg>
17
+ {% endif %}
18
+ </div>
19
+ </div>
20
+
21
+ {% else %}
22
+ <div class="tw-cursor-pointer {% if color_type == 'light' %} tw-bg-white/20 {% else %} tw-bg-black/20 {% endif %} tw-backdrop-blur-[10px] tw-rounded-[50%] max-lg:tw-w-[36px] max-lg:tw-h-[36px] lg:tw-w-[48px] lg:tw-h-[48px] tw-flex tw-justify-center tw-items-center">
23
+ <div class="lg:tw-w-[24px] lg:tw-h-[24px] tw-w-[18px] tw-h-[18px]">
24
+ {% if color_type == 'light' %}
25
+ <svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
26
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M17 12L9.92893 4.92893L9.93916 7.11487L14.8243 12L9.92893 16.8718L9.92893 19.0711L17 12Z" fill="white"/>
27
+ </svg>
28
+
29
+ {% else %}
30
+ <svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
31
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M17 12L9.92893 4.92893L9.93916 7.11487L14.8243 12L9.92893 16.8718L9.92893 19.0711L17 12Z" fill="black"/>
32
+ </svg>
33
+ {% endif %}
34
+ </div>
35
+ </div>
36
+ {% endif %}