playbook_ui 13.9.0.pre.alpha.play845allkitsbytypes1263 → 13.9.0.pre.alpha.play845allkitsbytypes1264

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: b5ef9474deca298344d2c388497f4a090ced68f56944c2f73e894b68ba08aa82
4
+ data.tar.gz: 5d0f76105a845c36e6cc2d23e2e00b7a0bf85a0e1a93ec9ecdb9304ddc652f54
5
5
  SHA512:
6
- metadata.gz: 1dd6619147cda00d230a6dc4f2010a96936f482d2d70d367c32ebe2bda44831cc5face8947d7e9ac8ba3bc4d1bde7da38dbff35845ec649dff79fadacfa71680
7
- data.tar.gz: 434f294ee2b796ffa2d4ea5fce5bafa8d38d85026102ffc633f7ad4158b2b37f1a69ea898591a42052a579251a01d280b2175854f0f71d77b12984920167f8b8
6
+ metadata.gz: 76c46a6dd52917b5a6e794efc19c1c466a9203902a6c8d3e7660c3e72301c77d895102ebf75d7ab540ddcb4b45558255bec6d69b142ea60dde03f22e2c69309d
7
+ data.tar.gz: 48304dce687cc1791dfe7bbd7d62a428d6cb65844d6b7386a7a2e379d0b5c933277a66064353da8e49a3f45fd5b5d87022ff546e761ccccfc41b1f8ce699e403
@@ -2,10 +2,6 @@
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
@@ -33,10 +29,19 @@ module Playbook
33
29
  def pb_kits(type: "rails", limit_examples: false, dark_mode: false)
34
30
  kits = get_kits(type)
35
31
 
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
32
+ # Initialize an empty string to store the rendered HTML
33
+ rendered_html = ""
34
+
35
+ # Iterate through the filtered kits and render their child components
36
+ kits.each do |kit|
37
+ kit["components"].each do |component|
38
+ # Check if the component is compatible with the specified type
39
+ rendered_html += render_pb_doc_kit(component["name"], type, limit_examples, true, dark_mode) if component["platforms"].include?(type)
40
+ end
41
+ end
42
+
43
+ # Return the rendered HTML as safe HTML
44
+ rendered_html.html_safe
40
45
  end
41
46
 
42
47
  def get_kits(type = "rails")
@@ -67,33 +72,10 @@ module Playbook
67
72
 
68
73
  # rubocop:disable Style/OptionalBooleanParameter
69
74
  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
75
+ title = pb_doc_render_clickable_title(kit_name, type)
76
+ ui = raw("<div class='pb--docItem-ui'>
77
+ #{pb_kit(kit: kit_name, type: type, show_code: code, limit_examples: limit_examples, dark_mode: dark_mode)}</div>")
78
+ title + ui
97
79
  end
98
80
 
99
81
  # rubocop:enable Style/OptionalBooleanParameter
@@ -115,23 +97,24 @@ module Playbook
115
97
  end
116
98
  end
117
99
 
118
- def pb_doc_render_clickable_title(kit, type)
100
+ # Modify the method to accept kit_name
101
+ def pb_doc_render_clickable_title(kit_name, type)
119
102
  url = "#"
120
103
  begin
121
104
  url = case type
122
105
  when "react"
123
- kit_show_reacts_path(kit)
106
+ kit_show_reacts_path(kit_name) # Use kit_name instead of kit
124
107
  when "swift"
125
- kit_show_swift_path(kit)
108
+ kit_show_swift_path(kit_name) # Use kit_name instead of kit
126
109
  else
127
- kit_show_path(kit)
110
+ kit_show_path(kit_name) # Use kit_name instead of kit
128
111
  end
129
112
  # FIXME: this is here because this helper generates a link for playbook website,
130
113
  # but shouldn't do anything when used elsewhere
131
114
  rescue
132
- puts "Kit Path Not Avaliable"
115
+ puts "Kit Path Not Available"
133
116
  end
134
- render inline: "<a href='#{url}'>#{pb_rails(:title, props: { text: pb_kit_title(kit), tag: 'h3', size: 2 })}</a>"
117
+ render inline: "<a href='#{url}'>#{pb_rails(:title, props: { text: pb_kit_title(kit_name), tag: 'h3', size: 2 })}</a>"
135
118
  end
136
119
  end
137
120
  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.play845allkitsbytypes1264"
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.play845allkitsbytypes1264
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX