playbook_ui 13.9.0.pre.alpha.play845allkitsbytypes1271 → 13.9.0.pre.alpha.play978makehighchartsadevdependencypoc1292
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_docs/kit_example.html.erb +2 -2
- data/dist/menu.yml +110 -281
- data/dist/playbook-rails.js +7 -7
- data/lib/playbook/pb_doc_helper.rb +45 -60
- data/lib/playbook/version.rb +1 -1
- metadata +2 -2
@@ -7,75 +7,61 @@ module Playbook
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def pb_kit(kit: "", type: "rails", show_code: true, limit_examples: false, dark_mode: false)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end.join.yield_self(&method(:raw))
|
23
|
-
end
|
10
|
+
examples = pb_doc_kit_examples(kit, type)
|
11
|
+
examples = examples.first(1) if limit_examples
|
12
|
+
examples.map do |example|
|
13
|
+
pb_rails "docs/kit_example", props: {
|
14
|
+
kit: kit,
|
15
|
+
example_title: example.values.first,
|
16
|
+
example_key: example.keys.first,
|
17
|
+
show_code: show_code,
|
18
|
+
type: type,
|
19
|
+
dark: dark_mode,
|
20
|
+
}
|
21
|
+
end.join.yield_self(&method(:raw))
|
24
22
|
end
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
# Initialize an empty string to store the rendered HTML
|
31
|
-
rendered_html = ""
|
24
|
+
def nav_hash_array(link)
|
25
|
+
link.first.last
|
26
|
+
end
|
32
27
|
|
33
|
-
|
28
|
+
# Deal with lists of kits, used in Playbook doc and Externally
|
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
|
34
33
|
kits.each do |kit|
|
35
|
-
kit
|
36
|
-
|
37
|
-
|
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)
|
38
40
|
end
|
39
41
|
end
|
40
|
-
|
41
|
-
# Return the rendered HTML as safe HTML
|
42
|
-
rendered_html.html_safe
|
42
|
+
raw("<div class='pb--docItem'>" + display_kits.join("</div><div class='pb--docItem'>") + "</div>")
|
43
43
|
end
|
44
|
+
# rubocop:enable Style/StringConcatenation
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
kits["kits"].select do |kit|
|
50
|
-
kit["components"].any? { |component| component["platforms"].include?(type) }
|
51
|
-
end
|
46
|
+
# rubocop:disable Naming/AccessorMethodName
|
47
|
+
def get_kits
|
48
|
+
menu = YAML.load_file(Playbook::Engine.root.join("dist/menu.yml"))
|
49
|
+
menu["kits"]
|
52
50
|
end
|
53
51
|
|
54
|
-
def
|
55
|
-
|
56
|
-
|
57
|
-
YAML.load_file(Playbook::Engine.root.join("dist/menu.yml"))["kits"].each do |kit|
|
58
|
-
kit_name = kit["name"]
|
59
|
-
components = kit["components"].map { |c| c["name"] }
|
60
|
-
|
61
|
-
all_kits << if components.size == 1
|
62
|
-
components.first
|
63
|
-
else
|
64
|
-
{ kit_name => components }
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
all_kits
|
52
|
+
def get_kits_pb_website
|
53
|
+
menu = YAML.load_file(Rails.root.join("config/menu.yml"))
|
54
|
+
menu["kits"]
|
69
55
|
end
|
56
|
+
# rubocop:enable Naming/AccessorMethodName
|
70
57
|
|
71
58
|
# rubocop:disable Style/OptionalBooleanParameter
|
72
|
-
def render_pb_doc_kit(
|
73
|
-
title = pb_doc_render_clickable_title(
|
59
|
+
def render_pb_doc_kit(kit, type, limit_examples, code = true, dark_mode = false)
|
60
|
+
title = pb_doc_render_clickable_title(kit, type)
|
74
61
|
ui = raw("<div class='pb--docItem-ui'>
|
75
|
-
#{pb_kit(kit:
|
62
|
+
#{pb_kit(kit: kit, type: type, show_code: code, limit_examples: limit_examples, dark_mode: dark_mode)}</div>")
|
76
63
|
title + ui
|
77
64
|
end
|
78
|
-
|
79
65
|
# rubocop:enable Style/OptionalBooleanParameter
|
80
66
|
|
81
67
|
private
|
@@ -95,24 +81,23 @@ module Playbook
|
|
95
81
|
end
|
96
82
|
end
|
97
83
|
|
98
|
-
|
99
|
-
def pb_doc_render_clickable_title(kit_name, type)
|
84
|
+
def pb_doc_render_clickable_title(kit, type)
|
100
85
|
url = "#"
|
101
86
|
begin
|
102
87
|
url = case type
|
103
88
|
when "react"
|
104
|
-
kit_show_reacts_path(
|
89
|
+
kit_show_reacts_path(kit)
|
105
90
|
when "swift"
|
106
|
-
kit_show_swift_path(
|
91
|
+
kit_show_swift_path(kit)
|
107
92
|
else
|
108
|
-
kit_show_path(
|
93
|
+
kit_show_path(kit)
|
109
94
|
end
|
110
95
|
# FIXME: this is here because this helper generates a link for playbook website,
|
111
96
|
# but shouldn't do anything when used elsewhere
|
112
97
|
rescue
|
113
|
-
puts "Kit Path Not
|
98
|
+
puts "Kit Path Not Avaliable"
|
114
99
|
end
|
115
|
-
render inline: "<a href='#{url}'>#{pb_rails(:title, props: { text: pb_kit_title(
|
100
|
+
render inline: "<a href='#{url}'>#{pb_rails(:title, props: { text: pb_kit_title(kit), tag: 'h3', size: 2 })}</a>"
|
116
101
|
end
|
117
102
|
end
|
118
103
|
end
|
data/lib/playbook/version.rb
CHANGED
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.
|
4
|
+
version: 13.9.0.pre.alpha.play978makehighchartsadevdependencypoc1292
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-10-
|
12
|
+
date: 2023-10-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|