zz-shopify-components 0.35.1-beta.2 → 0.35.1-beta.4

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.35.1-beta.2",
3
+ "version": "0.35.1-beta.4",
4
4
  "description": "Reusable Shopify components for theme projects",
5
5
  "keywords": [
6
6
  "shopify",
@@ -503,6 +503,7 @@ zz-card-strip section 是一个用于展示多张可展开卡片的横向交互
503
503
  #zz-card-strip-{{ section.id }} button.zz-mobile-only {
504
504
  width: 124px;
505
505
  height: 42px;
506
+ padding: 0px;
506
507
  }
507
508
  }
508
509
  </style>
@@ -678,6 +679,32 @@ zz-card-strip section 是一个用于展示多张可展开卡片的横向交互
678
679
  btn_id: mb_btn_id,
679
680
  modal_id: block.settings.modal_id
680
681
  %}
682
+ <script>
683
+ document.addEventListener('DOMContentLoaded', (event) => {
684
+ const btn = document.getElementsByClassName('{{ btn_class }}')
685
+ if(btn && btn[0]) {
686
+ {% for block in section.blocks %}
687
+ {% if block.type == 'cta_button' %}
688
+ {% if block.settings.click_event_class_name != blank %}
689
+ btn[0].addEventListener('click', (event) => {
690
+ window.zzAnalytics && window.zzAnalytics.trackEvent("{{ block.settings.click_event_class_name }}", {
691
+ timestamp: new Date().toISOString(),
692
+ });
693
+ });
694
+ {% endif %}
695
+ {% if block.settings.function_type == 'link_map' %}
696
+ if(window.bindSiteJump) {
697
+ bindSiteJump(btn[0], {{ block.settings.links | json }})
698
+ if (btn[1]) {
699
+ bindSiteJump(btn[1], {{ block.settings.links | json }})
700
+ }
701
+ }
702
+ {% endif %}
703
+ {% endif %}
704
+ {% endfor %}
705
+ }
706
+ })
707
+ </script>
681
708
  {% endif %}
682
709
  {% endfor %}
683
710
  </div>
@@ -1155,29 +1182,6 @@ zz-card-strip section 是一个用于展示多张可展开卡片的横向交互
1155
1182
  }
1156
1183
  })();
1157
1184
  </script>
1158
- <script>
1159
- document.addEventListener('DOMContentLoaded', (event) => {
1160
- const btn = document.getElementsByClassName('{{ btn_class }}')
1161
- if(btn && btn[0]) {
1162
- {% for block in section.blocks %}
1163
- {% if block.type == 'cta_button' %}
1164
- {% if block.settings.click_event_class_name != blank %}
1165
- btn[0].addEventListener('click', (event) => {
1166
- window.zzAnalytics && window.zzAnalytics.trackEvent("{{ block.settings.click_event_class_name }}", {
1167
- timestamp: new Date().toISOString(),
1168
- });
1169
- });
1170
- {% endif %}
1171
- {% if block.settings.function_type == 'link_map' %}
1172
- if(window.bindSiteJump) {
1173
- bindSiteJump(btn[0], {{ block.settings.links | json }})
1174
- }
1175
- {% endif %}
1176
- {% endif %}
1177
- {% endfor %}
1178
- }
1179
- })
1180
- </script>
1181
1185
 
1182
1186
  {% schema %}
1183
1187
  {
@@ -1,6 +1,8 @@
1
+ {% assign option_type = option_type | default: 'normal' | downcase | strip %}
2
+
1
3
  <div
2
4
  class='
3
- {% if option_name == 'Color' %}
5
+ {% if option_type == 'color' %}
4
6
  tw-grid tw-grid-cols-2 tw-gap-6
5
7
  {% else %}
6
8
  tw-space-y-[16px]
@@ -49,14 +51,14 @@
49
51
  {% comment %} 产品示例图 {% endcomment %}
50
52
  <div
51
53
  class='
52
- {% if option_name == 'Color' %}
54
+ {% if option_type == 'color' %}
53
55
  tw-flex tw-flex-col tw-space-y-6
54
56
  {% else %}
55
57
  tw-flex tw-space-x-[24px]
56
58
  {% endif %}
57
59
  '
58
60
  >
59
- {% if option_name == 'Color' %}
61
+ {% if option_type == 'color' %}
60
62
  <div
61
63
  class=' tw-w-[28px] tw-h-[28px] tw-rounded-full !tw-block {% if option.value != 'Black' %} tw-border-[1.5px] {% endif %} tw-border-[#d9d9d9]'
62
64
  style='background: {{ option_value.name }}'
@@ -5,6 +5,22 @@
5
5
  class=' tw-space-y-[48px]'
6
6
  >
7
7
  {% for item in product.options_with_values %}
8
+ {% liquid
9
+ assign option_type_key = 'option_' | append: item.position | append: '_type'
10
+ assign option_type = product.metafields.custom[option_type_key].value | default: ''
11
+
12
+ if option_type == blank
13
+ if item.name == 'Version' or item.name contains 'Bundle and save more'
14
+ assign option_type = 'version'
15
+ elsif item.name == 'Color'
16
+ assign option_type = 'color'
17
+ else
18
+ assign option_type = 'normal'
19
+ endif
20
+ endif
21
+
22
+ assign option_type = option_type | downcase | strip
23
+ %}
8
24
  <div>
9
25
  <div class='tw-flex tw-flex-col tw-items-start tw-justify-between tw-mb-[18px]'>
10
26
  <h2 class='tw-font-medium tw-text-black tw-text-[20px]'>
@@ -12,14 +28,13 @@
12
28
  </h2>
13
29
  </div>
14
30
 
15
- {% if item.name == 'Version'
16
- or item.name contains 'Bundle and save more'
17
- %}
31
+ {% if option_type == 'version' %}
18
32
  <div id='product-version-selector-container'>
19
33
  {% render 'zz-version-selector-simple',
20
34
  values: item.values,
21
35
  position: item.position,
22
36
  option_name: item.name,
37
+ option_type: option_type,
23
38
  show_basic: show_basic,
24
39
  basic_title: basic_title,
25
40
  discount_type: discount_type
@@ -31,11 +46,11 @@
31
46
  values: item.values,
32
47
  position: item.position,
33
48
  option_name: item.name,
34
- show_basic: show_basic,
49
+ option_type: option_type,
50
+ show_basic: show_basic
35
51
  %}
36
52
  </div>
37
53
  {% endif %}
38
-
39
54
  </div>
40
55
  {% endfor %}
41
56
  </product-buy-now-selector>
@@ -1,3 +1,5 @@
1
+ {% assign option_type = option_type | default: 'version' | downcase | strip %}
2
+
1
3
  <div class=' tw-space-y-[16px] ' id='product-version-selector'>
2
4
  {%- for value_item in values -%}
3
5
  {%- if value_item.variant.metafields.custom.basic == true -%}
@@ -74,9 +76,7 @@
74
76
  </h3>
75
77
 
76
78
  {% comment %} version 产品信息 {% endcomment %}
77
- {% if option_name == 'Version'
78
- or option_name contains 'Bundle and save more'
79
- %}
79
+ {% if option_type == 'version' %}
80
80
  <div class='tw-space-x-2 tw-flex tw-items-center'>
81
81
  <span class='tw-font-medium tw-text-[14px] tw-text-black'>
82
82
  {%- if show_basic and basic_variant.price != blank -%}
@@ -117,11 +117,7 @@
117
117
  {% endif %}
118
118
  </div>
119
119
  </div>
120
-
121
-
122
120
  </label>
123
-
124
-
125
121
  </div>
126
122
  {% endfor %}
127
123
  </div>
@@ -165,4 +161,3 @@
165
161
  border-bottom-right-radius: 12px;
166
162
  }
167
163
  </style>
168
-