zz-shopify-components 0.36.1-beta.0 → 0.36.1-beta.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zz-shopify-components",
3
- "version": "0.36.1-beta.0",
3
+ "version": "0.36.1-beta.2",
4
4
  "description": "Reusable Shopify components for theme projects",
5
5
  "keywords": [
6
6
  "shopify",
@@ -20,12 +20,21 @@
20
20
 
21
21
 
22
22
  @media (min-width: 1024px) {
23
+ #shopify-section-{{section.id}} .center-content {
24
+ {% if section.settings.site == 'central' %}
25
+ width: 85vw;
26
+ {% else %}
27
+ width: 100%;
28
+ padding-left: var(--center-content-padding, 100px);
29
+ padding-right: var(--center-content-padding, 100px);
30
+ {% endif %}
31
+ }
23
32
  #shopify-section-{{section.id}} .swiper-banner-video-img .swiper-wrapper {
24
33
  width: 100%;
25
34
  {% if section.settings.site == 'central' %}
26
35
  height: 100vh;
27
36
  {% else %}
28
- height: 600px !important;
37
+ height: 560px !important;
29
38
  {% endif %}
30
39
  }
31
40
  #shopify-section-{{section.id}} .swiper-banner-video-img .swiper-pagination-bullet {
@@ -124,9 +133,18 @@
124
133
  }
125
134
 
126
135
  }
136
+ @media (min-width: 1280px) {
137
+ #shopify-section-{{section.id}} .swiper-banner-video-img .swiper-wrapper {
138
+ {% if section.settings.site != 'central' %}
139
+ height: 600px !important;
140
+ {% endif %}
141
+ }
142
+ }
127
143
  @media (min-width: 1340px) {
128
144
  #shopify-section-{{section.id}} .center-content {
129
- width: 1220px;
145
+ {% if section.settings.site == 'central' %}
146
+ width: 1220px;
147
+ {% endif %}
130
148
  }
131
149
  #shopify-section-{{section.id}} .swiper-banner-video-img .swiper-pagination-bullet {
132
150
  width: 200px;
@@ -277,6 +295,9 @@
277
295
  font-size: 1.8rem;
278
296
  line-height: 1.5;
279
297
  }
298
+ #shopify-section-{{section.id}} .swiper-content-text {
299
+ padding: 0px 20px;
300
+ }
280
301
 
281
302
  }
282
303
  </style>
@@ -485,7 +506,7 @@
485
506
  "type": "text",
486
507
  "id": "btn_text",
487
508
  "label": "按钮一文字",
488
- "default": "Learn more",
509
+ "default": "Learn More",
489
510
  "visible_if": "{{ block.settings.btn_type == 'one' or block.settings.btn_type == 'two' }}"
490
511
  },
491
512
  {
@@ -537,7 +558,7 @@
537
558
  "type": "text",
538
559
  "id": "btn_text_two",
539
560
  "label": "按钮二文字",
540
- "default": "Learn more",
561
+ "default": "Buy Now",
541
562
  "visible_if": "{{ block.settings.btn_type == 'two' }}"
542
563
  },
543
564
  {
@@ -760,7 +781,7 @@
760
781
  "type": "text",
761
782
  "id": "btn_text",
762
783
  "label": "按钮一文字",
763
- "default": "Learn more",
784
+ "default": "Learn More",
764
785
  "visible_if": "{{ block.settings.btn_type == 'one' or block.settings.btn_type == 'two' }}"
765
786
  },
766
787
  {
@@ -812,7 +833,7 @@
812
833
  "type": "text",
813
834
  "id": "btn_text_two",
814
835
  "label": "按钮二文字",
815
- "default": "Learn more",
836
+ "default": "Buy Now",
816
837
  "visible_if": "{{ block.settings.btn_type == 'two' }}"
817
838
  },
818
839
  {
@@ -937,7 +958,7 @@
937
958
 
938
959
  {% endif %}
939
960
  <div
940
- class='center-content tw-absolute lg:tw-left-[50%] lg:tw-top-[50%] lg:tw-translate-x-[-50%] lg:tw-translate-y-[-50%] lg:tw-w-[85vw] tw-z-10 max-lg:tw-h-full max-lg:tw-top-0 max-lg:tw-left-0 max-lg:tw-w-full max-lg:tw-pt-[90px] tw-box-border max-lg:tw-flex max-lg:tw-flex-col max-lg:tw-items-center'
961
+ class='center-content tw-absolute lg:tw-left-[50%] lg:tw-top-[50%] lg:tw-translate-x-[-50%] lg:tw-translate-y-[-50%] tw-z-10 max-lg:tw-h-full max-lg:tw-top-0 max-lg:tw-left-0 max-lg:tw-w-full max-lg:tw-pt-[90px] tw-box-border max-lg:tw-flex max-lg:tw-flex-col max-lg:tw-items-center'
941
962
  >
942
963
  <div class='swiper-content-text {% if banner.settings.banner_type == 'image_type' or banner.settings.banner_type == 'title_description_type' %} lg:tw-w-[560px] {% else %} lg:tw-w-[784px] {% endif %}'>
943
964
  {%- if banner.settings.banner_type == 'product_type' or banner.settings.banner_type == 'title_description_type' or banner.settings.banner_type == 'discount_sale_type' -%}
@@ -1333,5 +1354,50 @@
1333
1354
 
1334
1355
  }
1335
1356
  handleBannerShow();
1336
- })
1357
+ });
1358
+ // 添加一个iife,监听窗口大小变化,动态调整 padding-left
1359
+ {% if section.settings.site == 'site' %}
1360
+ (function () {
1361
+ function updatePadding() {
1362
+
1363
+ const width = window.innerWidth;
1364
+ const section = document.getElementById('shopify-section-{{section.id}}');
1365
+ if (!section) return;
1366
+
1367
+ if (width <= 1024) {
1368
+ section.style.removeProperty('--center-content-padding');
1369
+ return;
1370
+ }
1371
+
1372
+ const maxWidth = 1920; // 设定一个"超大屏"的上限
1373
+ const minWidth = 1400; // 缩减到这个宽度停止缩减
1374
+ const maxPadding = 18; // rem
1375
+ const minPadding = 8.37; // rem
1376
+
1377
+ let padding;
1378
+
1379
+ if (width > minWidth && width <= maxWidth) {
1380
+ const ratio = (width - minWidth) / (maxWidth - minWidth);
1381
+ padding = minPadding + (maxPadding - minPadding) * ratio;
1382
+ } else if (width > maxWidth) {
1383
+ padding = maxPadding;
1384
+ } else {
1385
+ padding = minPadding;
1386
+ }
1387
+ console.log('updatePadding', padding);
1388
+
1389
+ section.style.setProperty('--center-content-padding', padding.toFixed(2) + 'rem');
1390
+ }
1391
+
1392
+ let resizeTimer;
1393
+ function handleResize() {
1394
+ clearTimeout(resizeTimer);
1395
+ resizeTimer = setTimeout(updatePadding, 300);
1396
+ }
1397
+
1398
+ window.addEventListener('resize', handleResize);
1399
+ updatePadding();
1400
+ })();
1401
+ {% endif %}
1402
+
1337
1403
  </script>