zz-shopify-components 0.12.1-beta.1 → 0.13.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.
@@ -6,7 +6,9 @@
6
6
  border-radius: 32px;
7
7
  background: #F5F5F6;
8
8
  }
9
-
9
+ html, body {
10
+ overflow-x: hidden;
11
+ }
10
12
  .zz-radio-tabs-black.zz-radio-tabs {
11
13
  background: #FFFFFF14;
12
14
  }
@@ -110,5 +110,8 @@
110
110
  #shopify-block-{{ block.id }} .color-title span{
111
111
  color: {{ block.settings.sub_text_color }} !important;
112
112
  }
113
+ #shopify-block-{{ block.id }} .color-title {
114
+ padding-left: 2 rem;
115
+ }
113
116
 
114
117
  </style>
@@ -162,7 +162,14 @@
162
162
  {
163
163
  "type": "number",
164
164
  "id": "pc_fixed_height",
165
- "label": "PC端固定高度",
165
+ "label": "PC端LG固定高度",
166
+ "default": 0,
167
+ "info": "默认自适应高度,单位:px",
168
+ },
169
+ {
170
+ "type": "number",
171
+ "id": "pc_xl_fixed_height",
172
+ "label": "PC端XL固定高度",
166
173
  "default": 0,
167
174
  "info": "默认自适应高度,单位:px",
168
175
  },
@@ -482,6 +489,15 @@
482
489
  transform: translateX(-50%);
483
490
  {% endif %}
484
491
  }
492
+ {% if block.settings.pc_xl_fixed_height != 0 %}
493
+ #shopify-block-{{ block.id }} .flex-layout-image {
494
+ height: {{ block.settings.pc_xl_fixed_height }}px;
495
+ }
496
+ #shopify-block-{{ block.id }} .flex-layout-video {
497
+ height: {{ block.settings.pc_xl_fixed_height }}px;
498
+ object-fit: cover;
499
+ }
500
+ {% endif %}
485
501
  }
486
502
  {% if block.settings.full_screen_bg %}
487
503
  #shopify-block-{{ block.id }} {
@@ -0,0 +1,280 @@
1
+ {% schema %}
2
+ {
3
+ "name": "Show More Information",
4
+ "class": "zz-show-more-information",
5
+ "settings": [
6
+ {
7
+ "type": "color_background",
8
+ "id": "background_color",
9
+ "label": "背景颜色",
10
+ "default": "rgba(0,0,0,0)"
11
+ },
12
+ {
13
+ "type": "header",
14
+ "content": "💻 PC端布局设置"
15
+ },
16
+
17
+ {
18
+ "type": "number",
19
+ "id": "pc_gap",
20
+ "label": "区块间距 (Gap)",
21
+ "default": 40
22
+ },
23
+
24
+ {
25
+ "type": "select",
26
+ "id": "pc_align",
27
+ "label": "PC横向对齐",
28
+ "options": [
29
+ { "value": "flex-start", "label": "起始对齐 (Flex Start)" },
30
+ { "value": "center", "label": "居中对齐 (Center)" },
31
+ { "value": "flex-end", "label": "末尾对齐 (Flex End)" },
32
+ { "value": "stretch", "label": "拉伸对齐 (Stretch)" }
33
+ ],
34
+ "default": "center"
35
+ },
36
+ {
37
+ "type": "number",
38
+ "id": "pc_padding_x",
39
+ "label": "PC端左右内边距",
40
+ "default": 0,
41
+ "info": "单位:px"
42
+ },
43
+ {
44
+ "type": "number",
45
+ "id": "pc_padding_top",
46
+ "label": "PC端顶部内边距 (px)",
47
+ "default": 0
48
+ },
49
+ {
50
+ "type": "number",
51
+ "id": "pc_padding_bottom",
52
+ "label": "PC端底部内边距 (px)",
53
+ "default": 0
54
+ },
55
+ {
56
+ "type": "number",
57
+ "id": "pc_border_radius",
58
+ "label": "PC端圆角 (px)",
59
+ "default": 0
60
+ },
61
+ {
62
+ "type": "checkbox",
63
+ "id": "pc_full_width",
64
+ "label": "是否全屏展示",
65
+ "default": true
66
+ },
67
+ {
68
+ "type": "number",
69
+ "id": "pc_xl_width",
70
+ "label": "XL屏幕内容区域宽度 (px)",
71
+ "default": 1200,
72
+ "visible_if": "{{ block.settings.pc_full_width == false }}",
73
+ "info": "非全屏展示时有效"
74
+ },
75
+ {
76
+ "type": "number",
77
+ "id": "pc_lg_width",
78
+ "label": "LG屏幕内容区域宽度 (vw)",
79
+ "default": 90,
80
+ "visible_if": "{{ block.settings.pc_full_width == false }}",
81
+ "info": "非全屏展示时有效"
82
+ },
83
+ {
84
+ "type": "header",
85
+ "content": "📱 移动端布局设置"
86
+ },
87
+ {
88
+ "type": "number",
89
+ "id": "mobile_gap",
90
+ "label": "移动区块间距 (Gap)",
91
+ "default": 20
92
+ },
93
+ {
94
+ "type": "select",
95
+ "id": "mobile_align",
96
+ "label": "移动横向对齐",
97
+ "options": [
98
+ { "value": "flex-start", "label": "起始对齐 (Flex Start)" },
99
+ { "value": "center", "label": "居中对齐 (Center)" },
100
+ { "value": "flex-end", "label": "末尾对齐 (Flex End)" },
101
+ { "value": "stretch", "label": "拉伸对齐 (Stretch)" }
102
+ ],
103
+ "default": "center"
104
+ },
105
+ {
106
+ "type": "number",
107
+ "id": "mobile_padding_x",
108
+ "label": "移动端左右内边距",
109
+ "default": 0,
110
+ "info": "单位:px"
111
+ },
112
+ {
113
+ "type": "number",
114
+ "id": "mobile_padding_top",
115
+ "label": "移动端顶部内边距 (px)",
116
+ "default": 0
117
+ },
118
+ {
119
+ "type": "number",
120
+ "id": "mobile_padding_bottom",
121
+ "label": "移动端底部内边距 (px)",
122
+ "default": 0
123
+ },
124
+ {
125
+ "type": "number",
126
+ "id": "mobile_border_radius",
127
+ "label": "移动端圆角 (px)",
128
+ "default": 0
129
+ },
130
+
131
+ ],
132
+ "blocks": [
133
+ {
134
+ "type": "@theme",
135
+ }
136
+ ],
137
+ "presets": [
138
+ {
139
+ "name": "Show More Information"
140
+ },
141
+
142
+ ]
143
+ }
144
+ {% endschema %}
145
+
146
+ <style>
147
+ #shopify-block-{{ block.id }} {
148
+ width: 100%;
149
+ }
150
+
151
+
152
+ #shopify-block-{{ block.id }} .zz-show-more-information-container {
153
+ box-sizing: border-box;
154
+ width: 100%;
155
+ display: flex;
156
+ flex-direction: column;
157
+ align-items: {{ block.settings.mobile_align }};
158
+ gap: {{ block.settings.mobile_gap }}px;
159
+ background-color: {{ block.settings.background_color }};
160
+ padding-top: {{ block.settings.mobile_padding_top }}px;
161
+ padding-bottom: {{ block.settings.mobile_padding_bottom }}px;
162
+ padding-left: {{ block.settings.mobile_padding_x }}px;
163
+ padding-right: {{ block.settings.mobile_padding_x }}px;
164
+ border-radius: {{ block.settings.mobile_border_radius }}px;
165
+ max-height: 300px;
166
+ overflow: hidden;
167
+ }
168
+
169
+ #shopify-block-{{ block.id }} .zz-show-more-information-container > * {
170
+ flex-shrink: 0; /* 子元素不压缩 */
171
+ }
172
+
173
+ @media (min-width: 1024px) {
174
+ #shopify-block-{{ block.id }} .zz-show-more-information-container {
175
+ flex-direction: column;
176
+ align-items: {{ block.settings.pc_align }};
177
+ gap: {{ block.settings.pc_gap }}px;
178
+ padding-top: {{ block.settings.pc_padding_top }}px;
179
+ padding-bottom: {{ block.settings.pc_padding_bottom }}px;
180
+ padding-left: {{ block.settings.pc_padding_x }}px;
181
+ padding-right: {{ block.settings.pc_padding_x }}px;
182
+ border-radius: {{ block.settings.pc_border_radius }}px;
183
+ max-height: 400px;
184
+ {% if block.settings.pc_full_width %}
185
+ width: 100%;
186
+ {% else %}
187
+ width: {{ block.settings.pc_lg_width }}vw;
188
+ margin: 0 auto;
189
+ {% endif %}
190
+ }
191
+ }
192
+
193
+ @media (min-width: 1280px) {
194
+ #shopify-block-{{ block.id }} .zz-show-more-information-container {
195
+ {% if block.settings.pc_full_width %}
196
+ width: 100%;
197
+ {% else %}
198
+ width: {{ block.settings.pc_xl_width }}px;
199
+ margin: 0 auto;
200
+ {% endif %}
201
+
202
+ }
203
+ }
204
+ #shopify-section-{{ section.id }} .rotate {
205
+ transition: all 0.3s;
206
+ transform: rotate(180deg);
207
+ }
208
+
209
+ .show-more-gradient-view {
210
+ background: linear-gradient(to bottom, transparent 0%, #ffffff 100%);
211
+ height:30px;
212
+ width: 100%;
213
+ }
214
+ </style>
215
+
216
+ <div class="zz-show-more-information-container tw-relative">
217
+ {% content_for 'blocks' %}
218
+ <div class="tw-h-[120px]">&nbsp;</div>
219
+ <div class="show-more-view tw-absolute tw-bottom-0 tw-left-0 tw-right-0 ">
220
+ <div class="show-more-gradient-view tw-h-[30px]">&nbsp;</div>
221
+ <div class="tw-flex tw-items-center tw-justify-center tw-h-[90px] tw-bg-white tw-mt-[-2px]">
222
+ <div class="show-more-view-icon tw-cursor-pointer lg:tw-w-[42px] lg:tw-h-[33px] max-lg:tw-w-[21px] max-lg:tw-h-[16px]">
223
+ <span class="max-lg:tw-hidden">
224
+ <svg width="42" height="33" viewBox="0 0 42 33" fill="none" xmlns="http://www.w3.org/2000/svg">
225
+ <path d="M3.22917 2.83398L20.8911 29.5273L38.8203 2.83398" stroke="#999999" stroke-width="5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
226
+ </svg>
227
+ </span>
228
+ <span class="lg:tw-hidden">
229
+ <svg width="21" height="16" viewBox="0 0 21 16" fill="none" xmlns="http://www.w3.org/2000/svg">
230
+ <path d="M1.10247 0.999999L10.2501 14.7377L19.5361 1" stroke="#999999" stroke-width="1.30211" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
231
+ </svg>
232
+ </span>
233
+
234
+ </div>
235
+ </div>
236
+
237
+ </div>
238
+ </div>
239
+
240
+ <script>
241
+ (function() {
242
+ let showMoreScrollHeight = 0
243
+ const section = document.getElementById("shopify-section-{{ section.id }}")
244
+ const listBox = section.getElementsByClassName('zz-show-more-information-container')[0]
245
+ const showMoreImg = section.getElementsByClassName('show-more-view-icon')[0]
246
+
247
+ showMoreImg.addEventListener('click', showMore)
248
+
249
+ function showMore(el) {
250
+ const isMoblie = window.innerWidth < 1024
251
+ console.log(listBox.offsetHeight)
252
+
253
+ if(showMoreImg.classList.contains('rotate')) {
254
+ showMoreImg.classList.remove("rotate")
255
+ if(isMoblie) {
256
+ listBox.style.maxHeight = '300px'
257
+ } else {
258
+ listBox.style.maxHeight = '400px'
259
+ }
260
+ setTimeout(() => {
261
+ window.scrollTo({
262
+ top: showMoreScrollHeight,
263
+ behavior: "smooth",
264
+ });
265
+ })
266
+ } else {
267
+ if (document.documentElement && document.documentElement.scrollTop) {
268
+ showMoreScrollHeight = document.documentElement.scrollTop;
269
+ } else if (document.body) {
270
+ showMoreScrollHeight = document.body.scrollTop;
271
+ }
272
+ showMoreImg.classList.add("rotate")
273
+ listBox.style.maxHeight = '5000px'
274
+ }
275
+ }
276
+
277
+ // 将函数暴露到全局作用域,以便HTML中的onclick事件可以调用
278
+ window.showMore = showMore;
279
+ })();
280
+ </script>
@@ -1,13 +1,23 @@
1
1
  {% schema %}
2
2
  {
3
3
  "name": "ZZ Tag",
4
- "class": "zz-tag",
4
+ "class": "zz-tag-block",
5
5
  "settings": [
6
6
  {
7
7
  "type": "text",
8
8
  "id": "tag",
9
9
  "label": "标签"
10
10
  },
11
+ {
12
+ "type": "select",
13
+ "id": "tag_type",
14
+ "label": "类型",
15
+ "options": [
16
+ { "value": "italic", "label": "斜体 (Italic)" },
17
+ { "value": "text", "label": "文字标签" },
18
+ ],
19
+ "default": "italic"
20
+ },
11
21
  {
12
22
  "type": "color",
13
23
  "id": "tag_color",
@@ -18,14 +28,88 @@
18
28
  "type": "color",
19
29
  "id": "tag_bg_color",
20
30
  "label": "标签背景颜色",
21
- "default": "#FF7700"
31
+ "default": "#FF7700",
22
32
  },
23
33
  {
24
34
  "type": "color_background",
25
35
  "id": "tag_bg_color_gradient",
26
36
  "label": "标签背景颜色(渐变)",
27
37
  "default": "linear-gradient(to right, #FF7700, #FFC081)"
28
- }
38
+ },
39
+ {
40
+ "type": "color",
41
+ "id": "border_color",
42
+ "label": "边框颜色",
43
+ "visible_if": "{{ block.settings.tag_type == 'text' }}"
44
+
45
+ },
46
+ {
47
+ "type": "number",
48
+ "id": "pc_border_radius",
49
+ "label": "PC端圆角",
50
+ "default": 10,
51
+ "info": "单位:px"
52
+ },
53
+ {
54
+ "type": "number",
55
+ "id": "mobile_border_radius",
56
+ "label": "移动端圆角",
57
+ "default": 10,
58
+ "info": "单位:px"
59
+ },
60
+ {
61
+ "type": "number",
62
+ "id": "pc_padding_x",
63
+ "label": "PC端左右内边距",
64
+ "default": 0,
65
+ "info": "单位:px"
66
+ },
67
+
68
+ {
69
+ "type": "number",
70
+ "id": "mobile_padding_x",
71
+ "label": "移动端左右内边距",
72
+ "default": 0,
73
+ "info": "单位:px"
74
+ },
75
+ {
76
+ "type": "number",
77
+ "id": "pc_padding_y",
78
+ "label": "PC端上下内边距",
79
+ "default": 0,
80
+ "info": "单位:px"
81
+ },
82
+ {
83
+ "type": "number",
84
+ "id": "mobile_padding_y",
85
+ "label": "移动端上下内边距",
86
+ "default": 0,
87
+ "info": "单位:px"
88
+ },
89
+ {
90
+ "type": "select",
91
+ "id": "font_weight",
92
+ "label": "Font Weight",
93
+ "options": [
94
+ {
95
+ "value": "400",
96
+ "label": "Regular"
97
+ },
98
+ {
99
+ "value": "500",
100
+ "label": "Medium"
101
+ },
102
+ {
103
+ "value": "600",
104
+ "label": "Semi Bold"
105
+ },
106
+ {
107
+ "value": "700",
108
+ "label": "Bold"
109
+ }
110
+ ],
111
+ "default": "500"
112
+ },
29
113
 
30
114
  ],
31
115
  "presets": [
@@ -41,10 +125,56 @@
41
125
  ],
42
126
  }
43
127
  {% endschema %}
44
-
45
- {% render 'zz-tag',
128
+ {% if block.settings.tag_type == 'italic' %}
129
+ {% render 'zz-tag',
46
130
  tag_bg_color_gradient: block.settings.tag_bg_color_gradient,
47
131
  tag_bg_color: block.settings.tag_bg_color,
48
132
  tag_color: block.settings.tag_color,
49
133
  tag: block.settings.tag
50
- %}
134
+ %}
135
+
136
+ {% else %}
137
+ <div
138
+ class='zz-text-tag tw-leading-[1.5] '
139
+ >
140
+ {{ block.settings.tag }}
141
+ </div>
142
+ {% endif %}
143
+
144
+ {% if block.settings.tag_type == 'text' %}
145
+ <style>
146
+ #shopify-block-{{ block.id }} .zz-text-tag{
147
+ color: {{ block.settings.tag_color }};
148
+ background: {{ block.settings.tag_bg_color }};
149
+ font-weight: {{ block.settings.font_weight }};
150
+ border-radius: {{ block.settings.mobile_border_radius }}px;
151
+ padding-top: {{ block.settings.mobile_padding_y }}px;
152
+ padding-bottom: {{ block.settings.mobile_padding_y }}px;
153
+ padding-left: {{ block.settings.mobile_padding_x }}px;
154
+ padding-right: {{ block.settings.mobile_padding_x }}px;
155
+ {% if block.settings.border_color != blank %}
156
+ border: 1px solid {{ block.settings.border_color }};
157
+ {% endif %}
158
+
159
+ }
160
+ @media (min-width: 1024px) {
161
+ #shopify-block-{{ block.id }} .zz-text-tag {
162
+ border-radius: {{ block.settings.pc_border_radius }}px;
163
+ padding-top: {{ block.settings.pc_padding_y }}px;
164
+ padding-bottom: {{ block.settings.pc_padding_y }}px;
165
+ padding-left: {{ block.settings.pc_padding_x }}px;
166
+ padding-right: {{ block.settings.pc_padding_x }}px;
167
+ {% if block.settings.border_color != blank %}
168
+ border: 2px solid {{ block.settings.border_color }};
169
+ {% endif %}
170
+
171
+ }
172
+ }
173
+
174
+ </style>
175
+
176
+
177
+ {% endif %}
178
+
179
+
180
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zz-shopify-components",
3
- "version": "0.12.1-beta.1",
3
+ "version": "0.13.0",
4
4
  "description": "Reusable Shopify components for theme projects",
5
5
  "keywords": [
6
6
  "shopify",
@@ -15,21 +15,33 @@
15
15
  @media (min-width: 1024px) {
16
16
  #shopify-section-{{section.id}} .swiper-banner-video-img .swiper-wrapper {
17
17
  width: 100%;
18
+ {% if section.settings.site == 'central' %}
18
19
  height: 660px !important;
20
+ {% else %}
21
+ height: 600px !important;
22
+ {% endif %}
19
23
  }
20
24
 
21
25
  }
22
26
  @media (min-width: 1440px) {
23
27
  #shopify-section-{{section.id}} .swiper-banner-video-img .swiper-wrapper {
24
28
  width: 100%;
29
+ {% if section.settings.site == 'central' %}
25
30
  height: 760px !important;
31
+ {% else %}
32
+ height: 660px !important;
33
+ {% endif %}
26
34
  }
27
35
 
28
36
  }
29
37
  @media (min-width: 1536px) {
30
38
  #shopify-section-{{section.id}} .swiper-banner-video-img .swiper-wrapper {
31
39
  width: 100%;
40
+ {% if section.settings.site == 'central' %}
32
41
  height: 860px !important;
42
+ {% else %}
43
+ height: 700px !important;
44
+ {% endif %}
33
45
  }
34
46
 
35
47
  }
@@ -126,6 +138,23 @@
126
138
  {
127
139
  "name": "Swiper Banner V3",
128
140
  "settings": [
141
+ {
142
+ "type": "select",
143
+ "id": "site",
144
+ "label": "站点选择",
145
+ "info": "官网比站点banner更高",
146
+ "options": [
147
+ {
148
+ "value": "central",
149
+ "label": "官网"
150
+ },
151
+ {
152
+ "value": "site",
153
+ "label": "站点"
154
+ }
155
+ ],
156
+ "default": "central"
157
+ },
129
158
  {
130
159
  "type": "range",
131
160
  "id": "padding_top",
@@ -26,8 +26,10 @@
26
26
  | image_tag:
27
27
  alt: image_alt,
28
28
  class: pc_classes,
29
- widths: '800, 1000, 1200, 1500, 1800 2000 3000 4000 5000',
30
- loading: lazy_load
29
+ widths: '1000, 1500, 2000, 3000, 4000, 5000',
30
+ loading: lazy_load,
31
+ sizes: '8000px',
32
+ fetchpriority:"high"
31
33
  }}
32
34
  {%- endif -%}
33
35
  {%- if mb_image -%}
@@ -37,7 +39,9 @@
37
39
  | image_tag:
38
40
  alt: image_alt,
39
41
  class: mb_classes,
40
- widths: '400, 600, 800',
41
- loading: lazy_load
42
+ widths: '400, 800, 1200, 1500',
43
+ loading: lazy_load,
44
+ sizes: '1500px',
45
+ fetchpriority:"high"
42
46
  }}
43
47
  {%- endif -%}
@@ -7,7 +7,7 @@
7
7
  pc_width: pc 端宽度, 做图片尺寸优化
8
8
  mb_width: 移动端宽度, 做图片尺寸优化
9
9
  {% endcomment %}
10
- {%- assign pc_width = pc_width | default: 4800 -%}
10
+ {%- assign pc_width = pc_width | default: 5000 -%}
11
11
  {%- assign mb_width = mb_width | default: 1200 -%}
12
12
 
13
13
  {%- assign pc_classes = class_name | append: ' max-lg:tw-hidden tw-w-full tw-h-auto tw-object-cover' -%}
@@ -26,8 +26,10 @@
26
26
  | image_tag:
27
27
  alt: image_alt,
28
28
  class: pc_classes,
29
- widths: '800, 1000, 1200, 1500, 1800 2000 3000 4000 5000',
30
- loading: lazy_load
29
+ widths: '1000, 1500, 2000, 3000, 4000, 5000',
30
+ loading: lazy_load,
31
+ sizes: '8000px',
32
+ fetchpriority:"high"
31
33
  }}
32
34
  {%- endif -%}
33
35
  {%- if mb_image -%}
@@ -37,7 +39,9 @@
37
39
  | image_tag:
38
40
  alt: image_alt,
39
41
  class: mb_classes,
40
- widths: '400, 600, 800 1200',
41
- loading: lazy_load
42
+ widths: '400, 800, 1200, 1500',
43
+ loading: lazy_load,
44
+ sizes: '1500px',
45
+ fetchpriority:"high"
42
46
  }}
43
47
  {%- endif -%}