playbook_ui_docs 13.8.0.pre.alpha.play845allkitsbytypes1258 → 13.9.0.pre.alpha.play845addswiftkitspage1272

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ddf86926af8cd1c684471ea7f309297f8b6a50dd4c62dc8a259130e338f8929f
4
- data.tar.gz: ffa2221b03f5d64afb802fef29dc50887d1c626e8a32ab415ee1afe0c66adf03
3
+ metadata.gz: 7996cc53eb36000b43ccd4f3ffc7596e478724599b22bb59f823fc497e665a8c
4
+ data.tar.gz: 138d68b77389834b52a49f3305c2e8b5d549d00ead4bd37f99c0cf68f0c00d81
5
5
  SHA512:
6
- metadata.gz: 1f67f812a570779945937a10c9334febeee4ac267cb5289025ed9bad78d84620b7cb090866ef7fb96f02f600b18d96ac2aecafff6bb1a388c38a04c6437926bb
7
- data.tar.gz: e56e17062d3ec23d7d398295c36a0b6848c163c758c40bcd10cd2c565ec732fc0b1e0da1006c09166c213a3ee5a40254fa604e7b888800f134325a70d8eee3a5
6
+ metadata.gz: 641c7061cd7e56dc2c3c59d324548c6b4cf412e447cf9390ff7e6af4c11402cbc0a1689aef6e93538cf7dfb1e3c5afbed726600341f063f811de40cc00717b33
7
+ data.tar.gz: c8a698028618d4c1893a91c9387ecec56c5c4404433c3e7053b2c235adae66d04165443fdfd630ed72b3f2a057438f5b0328c2ecde436563b54bcbd3c03bd8d2
@@ -1,5 +1,5 @@
1
1
  <%= pb_rails("button", props: { count: 153, highlight: false, icon: "&#127881;", classname: "count", id: "reaction-button-highlight", variant: "reaction" }) %>
2
- <%= pb_rails("button", props: { count: 5, icon: "😍", variant: "reaction", margin_left: "lg" }) %>
2
+ <%= pb_rails("button", props: { count: 5, icon: "1️⃣", variant: "reaction", margin_left: "lg" }) %>
3
3
  <%= pb_rails("button", props: { variant: "reaction", margin_left: "lg" }) %>
4
4
  <%= pb_rails("button", props: { icon: "user", variant: "reaction", margin_left: "lg" }) %>
5
5
 
@@ -19,7 +19,7 @@ return (
19
19
  />
20
20
  <Button
21
21
  count={5}
22
- icon="😍"
22
+ icon="1️⃣"
23
23
  marginLeft='lg'
24
24
  tabIndex={0}
25
25
  variant="reaction"
@@ -26,81 +26,45 @@ module PlaybookWebsite
26
26
  end
27
27
 
28
28
  # Deal with lists of kits, used in Playbook doc and Externally
29
- def pb_kits(type: "rails", limit_examples: false, dark_mode: false)
30
- kits = get_kits(type)
31
-
32
- # Iterate through the filtered kits and render them
33
- kits.map do |kit|
34
- render_pb_doc_kit(kit["name"], type, limit_examples, true, dark_mode)
35
- end.join.html_safe
29
+ # rubocop:disable Style/StringConcatenation
30
+ def pb_kits(type: "rails", limit_examples: false, dark_mode: false, method: get_kits)
31
+ display_kits = []
32
+ kits = method
33
+ kits.each do |kit|
34
+ if kit.is_a?(Hash)
35
+ nav_hash_array(kit).each do |sub_kit|
36
+ display_kits << render_pb_doc_kit(sub_kit, type, limit_examples, false, dark_mode)
37
+ end
38
+ else
39
+ display_kits << render_pb_doc_kit(kit, type, limit_examples, false, dark_mode)
40
+ end
41
+ end
42
+ raw("<div class='pb--docItem'>" + display_kits.join("</div><div class='pb--docItem'>") + "</div>")
36
43
  end
37
-
38
- def get_kits(type = "rails")
39
- kits = MENU["kits"] || []
40
-
44
+ # rubocop:enable Style/StringConcatenation
45
+
46
+ # rubocop:disable Naming/AccessorMethodName
47
+ # def get_kits
48
+ # menu = YAML.load_file(Playbook::Engine.root.join("dist/menu.yml"))
49
+ # menu["kits"]
50
+ # end
51
+ def get_kits(_type = "rails")
52
+ aggregate_kits || []
41
53
  # Filter kits that have at least one component compatible with the type
42
- kits.select do |kit|
43
- kit["components"].any? { |component| component["platforms"].include?(type) }
44
- end
45
54
  end
46
55
 
47
- def aggregate_kits
48
- all_kits = []
49
-
50
- MENU["kits"].each do |kit|
51
- kit_name = kit["name"]
52
- components = kit["components"].map { |c| c["name"] }
53
-
54
- all_kits << if components.size == 1
55
- components.first
56
- else
57
- { kit_name => components }
58
- end
59
- end
60
-
61
- all_kits
56
+ def get_kits_pb_website
57
+ menu = YAML.load_file(Rails.root.join("config/menu.yml"))
58
+ menu["kits"]
62
59
  end
60
+ # rubocop:enable Naming/AccessorMethodName
63
61
 
64
62
  # rubocop:disable Style/OptionalBooleanParameter
65
- def render_pb_doc_kit(kit_name, type, limit_examples, code = true, dark_mode = false)
66
- parent_kit = MENU["kits"].find { |kit| kit["name"] == kit_name }
67
-
68
- # Initialize component_content as an empty string
69
- component_content = ""
70
- title = ""
71
-
72
- # Check if parent_kit is nil
73
- if parent_kit.nil?
74
- title = pb_doc_render_clickable_title(kit_name, type)
75
- component_content = raw("<div class='pb--docItem-ui'>
76
- #{pb_kit(kit: kit_name, type: type, show_code: code, limit_examples: limit_examples, dark_mode: dark_mode)}</div>")
77
- else
78
- # Filter components based on the specified type
79
- components = parent_kit["components"].select { |component| component["platforms"].include?(type) }
80
-
81
- # If it's a parent with components, accumulate the UI content for child components
82
- if components.any?
83
- component_content = components.map do |component|
84
- component_name = component["name"]
85
- title = pb_doc_render_clickable_title(component_name, type) # Use component_name for the title
86
-
87
- # Render the component UI content with the same styles/tags as the parent
88
- component_ui = raw("<div class='pb--docItem-ui'>
89
- #{pb_kit(kit: component_name, type: type, show_code: code, limit_examples: limit_examples, dark_mode: dark_mode)}
90
- </div>")
91
-
92
- # Combine the component name and component UI content
93
- "#{title}#{component_ui}"
94
- end.join.to_s
95
- end
96
- end
97
-
98
- # Combine the component content and UI content for the parent kit
99
- if parent_kit.nil?
100
- "#{title}#{component_content}".to_s
101
- else
102
- component_content.to_s.to_s
103
- end
63
+ def render_pb_doc_kit(kit, type, limit_examples, code = true, dark_mode = false)
64
+ title = pb_doc_render_clickable_title(kit, type)
65
+ ui = raw("<div class='pb--docItem-ui'>
66
+ #{pb_kit(kit: kit, type: type, show_code: code, limit_examples: limit_examples, dark_mode: dark_mode)}</div>")
67
+ title + ui
104
68
  end
105
69
  # rubocop:enable Style/OptionalBooleanParameter
106
70