zz-shopify-components 0.36.1-beta.1 → 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.1",
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;
@@ -488,7 +506,7 @@
488
506
  "type": "text",
489
507
  "id": "btn_text",
490
508
  "label": "按钮一文字",
491
- "default": "Learn more",
509
+ "default": "Learn More",
492
510
  "visible_if": "{{ block.settings.btn_type == 'one' or block.settings.btn_type == 'two' }}"
493
511
  },
494
512
  {
@@ -540,7 +558,7 @@
540
558
  "type": "text",
541
559
  "id": "btn_text_two",
542
560
  "label": "按钮二文字",
543
- "default": "Learn more",
561
+ "default": "Buy Now",
544
562
  "visible_if": "{{ block.settings.btn_type == 'two' }}"
545
563
  },
546
564
  {
@@ -763,7 +781,7 @@
763
781
  "type": "text",
764
782
  "id": "btn_text",
765
783
  "label": "按钮一文字",
766
- "default": "Learn more",
784
+ "default": "Learn More",
767
785
  "visible_if": "{{ block.settings.btn_type == 'one' or block.settings.btn_type == 'two' }}"
768
786
  },
769
787
  {
@@ -815,7 +833,7 @@
815
833
  "type": "text",
816
834
  "id": "btn_text_two",
817
835
  "label": "按钮二文字",
818
- "default": "Learn more",
836
+ "default": "Buy Now",
819
837
  "visible_if": "{{ block.settings.btn_type == 'two' }}"
820
838
  },
821
839
  {
@@ -940,7 +958,7 @@
940
958
 
941
959
  {% endif %}
942
960
  <div
943
- 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'
944
962
  >
945
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 %}'>
946
964
  {%- if banner.settings.banner_type == 'product_type' or banner.settings.banner_type == 'title_description_type' or banner.settings.banner_type == 'discount_sale_type' -%}
@@ -1336,5 +1354,50 @@
1336
1354
 
1337
1355
  }
1338
1356
  handleBannerShow();
1339
- })
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
+
1340
1403
  </script>