playbook_ui 13.9.0.pre.alpha.play845allkitsbytypes1263 → 13.9.0.pre.alpha.play845allkitsbytypes1266

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46007f2f1ef36ad550a50a69cb3cba12635054933359cf2e3e213a899b274a56
4
- data.tar.gz: a960f5d51bf2219ab25bf9bcb50b1c6b1eb9f27498a585ad4238fdd898413407
3
+ metadata.gz: dd75764f72b4bb2917191a2c207c70b5d15a693fddfdfa22ceecaaba99612e53
4
+ data.tar.gz: 312b4da9ec9808ad0288fd4ab4e89631160146e661dd06f2e44cff1db29f236a
5
5
  SHA512:
6
- metadata.gz: 1dd6619147cda00d230a6dc4f2010a96936f482d2d70d367c32ebe2bda44831cc5face8947d7e9ac8ba3bc4d1bde7da38dbff35845ec649dff79fadacfa71680
7
- data.tar.gz: 434f294ee2b796ffa2d4ea5fce5bafa8d38d85026102ffc633f7ad4158b2b37f1a69ea898591a42052a579251a01d280b2175854f0f71d77b12984920167f8b8
6
+ metadata.gz: a3cb3ac2786b777f5b619e44b2ccb3a9fcefcde3c30823d8228f823974b597dc8b4bd20374c7c62d6d2969917a82195d36d257074c6eac73c2642f79ce2ec152
7
+ data.tar.gz: b1d30a2524cdda08af688d5b2546ab3136e31beda614af2792b6c08c551e684c1d4844fb5796b9e37a10107b59acc4f2f1a9cab6f0de442ef5f17b37efe0b00c
@@ -2,15 +2,14 @@
2
2
 
3
3
  module Playbook
4
4
  module PbDocHelper
5
- def render_markdown(text)
6
- PlaybookWebsite::Markdown::Helper.markdown(text)
7
- end
8
-
9
5
  def pb_kit_title(title)
10
6
  title.remove("pb_").titleize.tr("_", " ")
11
7
  end
12
8
 
13
9
  def pb_kit(kit: "", type: "rails", show_code: true, limit_examples: false, dark_mode: false)
10
+ # Check if the type is "swift" and return an empty string if it is
11
+ return "" if type == "swift"
12
+
14
13
  examples = pb_doc_kit_examples(kit, type)
15
14
  examples = examples.first(1) if limit_examples
16
15
  examples.map do |example|
@@ -25,18 +24,23 @@ module Playbook
25
24
  end.join.yield_self(&method(:raw))
26
25
  end
27
26
 
28
- def nav_hash_array(link)
29
- link.first.last
30
- end
31
-
32
27
  # Deal with lists of kits, used in Playbook doc and Externally
33
28
  def pb_kits(type: "rails", limit_examples: false, dark_mode: false)
34
29
  kits = get_kits(type)
35
30
 
36
- # Iterate through the filtered kits and render them
37
- kits.map do |kit|
38
- render_pb_doc_kit(kit["name"], type, limit_examples, true, dark_mode)
39
- end.join.html_safe
31
+ # Initialize an empty string to store the rendered HTML
32
+ rendered_html = ""
33
+
34
+ # Iterate through the filtered kits and render their child components
35
+ kits.each do |kit|
36
+ kit["components"].each do |component|
37
+ # Check if the component is compatible with the specified type
38
+ rendered_html += render_pb_doc_kit(component["name"], type, limit_examples, true, dark_mode) if component["platforms"].include?(type)
39
+ end
40
+ end
41
+
42
+ # Return the rendered HTML as safe HTML
43
+ rendered_html.html_safe
40
44
  end
41
45
 
42
46
  def get_kits(type = "rails")
@@ -67,33 +71,10 @@ module Playbook
67
71
 
68
72
  # rubocop:disable Style/OptionalBooleanParameter
69
73
  def render_pb_doc_kit(kit_name, type, limit_examples, code = true, dark_mode = false)
70
- parent_kit = YAML.load_file(Playbook::Engine.root.join("dist/menu.yml"))["kits"].find { |kit| kit["name"] == kit_name }
71
-
72
- # Initialize component_content as an empty string
73
- component_content = ""
74
-
75
- # Check if parent_kit is not nil
76
- # Filter components based on the specified type
77
- components = parent_kit["components"].select { |component| component["platforms"].include?(type) }
78
-
79
- # If it's a parent with components, accumulate the UI content for child components
80
- if components.any?
81
- component_content = components.map do |component|
82
- component_name = component["name"]
83
- title = pb_doc_render_clickable_title(component_name, type) # Use component_name for the title
84
-
85
- # Render the component UI content with the same styles/tags as the parent
86
- component_ui = raw("<div class='pb--docItem-ui'>
87
- #{pb_kit(kit: component_name, type: type, show_code: code, limit_examples: limit_examples, dark_mode: dark_mode)}
88
- </div>")
89
-
90
- # Combine the component name and component UI content
91
- "#{title}#{component_ui}"
92
- end.join.to_s
93
- end
94
-
95
- # Return the component_content
96
- component_content.to_s
74
+ title = pb_doc_render_clickable_title(kit_name, type)
75
+ ui = 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
+ title + ui
97
78
  end
98
79
 
99
80
  # rubocop:enable Style/OptionalBooleanParameter
@@ -115,23 +96,24 @@ module Playbook
115
96
  end
116
97
  end
117
98
 
118
- def pb_doc_render_clickable_title(kit, type)
99
+ # Modify the method to accept kit_name
100
+ def pb_doc_render_clickable_title(kit_name, type)
119
101
  url = "#"
120
102
  begin
121
103
  url = case type
122
104
  when "react"
123
- kit_show_reacts_path(kit)
105
+ kit_show_reacts_path(kit_name) # Use kit_name instead of kit
124
106
  when "swift"
125
- kit_show_swift_path(kit)
107
+ kit_show_swift_path(kit_name) # Use kit_name instead of kit
126
108
  else
127
- kit_show_path(kit)
109
+ kit_show_path(kit_name) # Use kit_name instead of kit
128
110
  end
129
111
  # FIXME: this is here because this helper generates a link for playbook website,
130
112
  # but shouldn't do anything when used elsewhere
131
113
  rescue
132
- puts "Kit Path Not Avaliable"
114
+ puts "Kit Path Not Available"
133
115
  end
134
- render inline: "<a href='#{url}'>#{pb_rails(:title, props: { text: pb_kit_title(kit), tag: 'h3', size: 2 })}</a>"
116
+ render inline: "<a href='#{url}'>#{pb_rails(:title, props: { text: pb_kit_title(kit_name), tag: 'h3', size: 2 })}</a>"
135
117
  end
136
118
  end
137
119
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "13.9.0"
5
- VERSION = "13.9.0.pre.alpha.play845allkitsbytypes1263"
5
+ VERSION = "13.9.0.pre.alpha.play845allkitsbytypes1266"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.9.0.pre.alpha.play845allkitsbytypes1263
4
+ version: 13.9.0.pre.alpha.play845allkitsbytypes1266
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX