primer_view_components 0.0.116 → 0.0.117
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/assets/styles/primer_view_components.css +2 -2
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.json +1 -1
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/auto_complete/item.rb +4 -4
- data/app/components/primer/alpha/auto_complete.rb +6 -6
- data/app/components/primer/alpha/dialog.rb +0 -2
- data/app/components/primer/alpha/dropdown.rb +53 -53
- data/app/components/primer/alpha/hellip_button.rb +41 -0
- data/app/components/primer/alpha/hidden_text_expander.rb +1 -1
- data/app/components/primer/alpha/layout.rb +48 -48
- data/app/components/primer/alpha/menu.css +1 -1
- data/app/components/primer/alpha/menu.css.json +1 -1
- data/app/components/primer/alpha/menu.css.map +1 -1
- data/app/components/primer/alpha/menu.rb +5 -5
- data/app/components/primer/alpha/segmented_control.rb +20 -20
- data/app/components/primer/{tab_container_component.d.ts → alpha/tab_container.d.ts} +0 -0
- data/app/components/primer/{tab_container_component.js → alpha/tab_container.js} +0 -0
- data/app/components/primer/alpha/tab_container.rb +43 -0
- data/app/components/primer/{tab_container_component.ts → alpha/tab_container.ts} +0 -0
- data/app/components/primer/alpha/tab_nav.css +1 -1
- data/app/components/primer/alpha/tab_nav.css.json +1 -1
- data/app/components/primer/alpha/tab_nav.css.map +1 -1
- data/app/components/primer/alpha/tab_nav.rb +32 -32
- data/app/components/primer/alpha/tool_tip.js +3 -7
- data/app/components/primer/alpha/tool_tip.ts +3 -7
- data/app/components/primer/alpha/tooltip.rb +18 -18
- data/app/components/primer/alpha/underline_nav.css +1 -1
- data/app/components/primer/alpha/underline_nav.css.json +1 -1
- data/app/components/primer/alpha/underline_nav.css.map +1 -1
- data/app/components/primer/alpha/underline_nav.rb +18 -18
- data/app/components/primer/beta/auto_complete/item.rb +2 -3
- data/app/components/primer/beta/auto_complete.rb +14 -16
- data/app/components/primer/beta/avatar_stack.rb +12 -14
- data/app/components/primer/beta/blankslate.rb +0 -1
- data/app/components/primer/beta/border_box/header.rb +0 -2
- data/app/components/primer/beta/border_box.rb +0 -2
- data/app/components/primer/beta/breadcrumbs.css +1 -1
- data/app/components/primer/beta/breadcrumbs.css.json +1 -1
- data/app/components/primer/beta/breadcrumbs.css.map +1 -1
- data/app/components/primer/beta/breadcrumbs.rb +0 -1
- data/app/components/primer/beta/button.rb +9 -10
- data/app/components/primer/beta/button_group.rb +0 -1
- data/app/components/primer/beta/details.rb +0 -1
- data/app/components/primer/beta/flash.rb +0 -1
- data/app/components/primer/beta/link.rb +2 -3
- data/app/components/primer/beta/octicon.rb +0 -1
- data/app/components/primer/beta/popover.rb +0 -1
- data/app/components/primer/{state_component.css → beta/state.css} +0 -0
- data/app/components/primer/beta/state.css.json +1 -0
- data/app/components/primer/beta/state.css.map +1 -0
- data/app/components/primer/{state_component.pcss → beta/state.pcss} +0 -0
- data/app/components/primer/beta/state.rb +76 -0
- data/app/components/primer/{subhead_component.css → beta/subhead.css} +0 -0
- data/app/components/primer/beta/subhead.css.json +1 -0
- data/app/components/primer/beta/subhead.css.map +1 -0
- data/app/components/primer/{subhead_component.html.erb → beta/subhead.html.erb} +0 -0
- data/app/components/primer/{subhead_component.pcss → beta/subhead.pcss} +0 -0
- data/app/components/primer/beta/subhead.rb +135 -0
- data/app/components/primer/{timeline_item_component.css → beta/timeline_item.css} +0 -0
- data/app/components/primer/beta/timeline_item.css.json +1 -0
- data/app/components/primer/beta/timeline_item.css.map +1 -0
- data/app/components/primer/{timeline_item_component.html.erb → beta/timeline_item.html.erb} +0 -0
- data/app/components/primer/{timeline_item_component.pcss → beta/timeline_item.pcss} +0 -0
- data/app/components/primer/beta/timeline_item.rb +90 -0
- data/app/components/primer/beta/truncate.css +1 -1
- data/app/components/primer/beta/truncate.css.json +1 -1
- data/app/components/primer/beta/truncate.css.map +1 -1
- data/app/components/primer/beta/truncate.rb +0 -1
- data/app/components/primer/button_component.rb +9 -9
- data/app/components/primer/component.rb +0 -1
- data/app/components/primer/hellip_button.rb +2 -34
- data/app/components/primer/navigation/tab_component.rb +16 -16
- data/app/components/primer/primer.d.ts +1 -1
- data/app/components/primer/primer.js +1 -1
- data/app/components/primer/primer.pcss +3 -3
- data/app/components/primer/primer.ts +1 -1
- data/app/components/primer/state_component.rb +2 -69
- data/app/components/primer/subhead_component.rb +2 -128
- data/app/components/primer/tab_container_component.rb +2 -36
- data/app/components/primer/timeline_item_component.rb +5 -78
- data/app/forms/example_toggle_switch_form/example_field_caption.html.erb +1 -0
- data/app/forms/example_toggle_switch_form.rb +8 -0
- data/app/forms/submit_button_form.rb +4 -4
- data/app/lib/primer/tabbed_component_helper.rb +1 -1
- data/lib/primer/deprecations.rb +7 -13
- data/lib/primer/deprecations.yml +24 -0
- data/lib/primer/forms/button.html.erb +2 -2
- data/lib/primer/forms/dsl/toggle_switch_input.rb +35 -0
- data/lib/primer/forms/toggle_switch.html.erb +17 -0
- data/lib/primer/forms/toggle_switch.rb +19 -0
- data/lib/primer/forms/toggle_switch_form.rb +74 -0
- data/lib/primer/view_components/linters/subhead_component_migration_counter.rb +1 -1
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/rubocop/cop/primer/component_name_migration.rb +2 -1
- data/lib/tasks/docs.rake +6 -6
- data/previews/primer/alpha/action_list_preview.rb +44 -44
- data/previews/primer/alpha/dropdown_preview.rb +97 -97
- data/previews/primer/alpha/hellip_button_preview.rb +24 -0
- data/previews/primer/alpha/layout_preview.rb +63 -63
- data/previews/primer/alpha/menu_preview/default.html.erb +5 -5
- data/previews/primer/alpha/menu_preview/playground.html.erb +5 -5
- data/previews/primer/alpha/segmented_control_preview.rb +60 -60
- data/previews/primer/alpha/tab_nav_preview.rb +22 -22
- data/previews/primer/alpha/tab_panels_preview.rb +2 -2
- data/previews/primer/alpha/tooltip_preview/with_multiple_on_a_page.html.erb +6 -6
- data/previews/primer/alpha/tooltip_preview.rb +12 -12
- data/previews/primer/alpha/underline_nav_preview.rb +4 -4
- data/previews/primer/alpha/underline_panels_preview.rb +8 -8
- data/previews/primer/beta/auto_complete_item_preview/default.html.erb +2 -2
- data/previews/primer/beta/auto_complete_item_preview/playground.html.erb +2 -2
- data/previews/primer/beta/auto_complete_item_preview/with_description.html.erb +3 -3
- data/previews/primer/beta/auto_complete_preview/with_submit_button.html.erb +2 -2
- data/previews/primer/beta/auto_complete_preview.rb +18 -18
- data/previews/primer/beta/avatar_stack_preview.rb +32 -32
- data/previews/primer/beta/blankslate_preview.rb +40 -40
- data/previews/primer/beta/border_box_preview.rb +38 -38
- data/previews/primer/beta/breadcrumbs_preview.rb +2 -2
- data/previews/primer/beta/button_group_preview.rb +10 -10
- data/previews/primer/beta/button_preview/all_schemes.html.erb +4 -4
- data/previews/primer/beta/button_preview/invisible_all_visuals.html.erb +16 -16
- data/previews/primer/beta/button_preview/leading_visual.html.erb +2 -2
- data/previews/primer/beta/button_preview/trailing_action.html.erb +2 -2
- data/previews/primer/beta/button_preview/trailing_visual.html.erb +2 -2
- data/previews/primer/beta/button_preview/with_tooltip.html.erb +2 -2
- data/previews/primer/beta/details_preview.rb +6 -6
- data/previews/primer/beta/state_preview.rb +66 -0
- data/previews/primer/beta/subhead_preview/actions.html.erb +14 -0
- data/previews/primer/beta/subhead_preview.rb +99 -0
- data/previews/primer/beta/timeline_item_preview.rb +30 -0
- data/previews/primer/forms/forms_preview/example_toggle_switch_form.html.erb +1 -0
- data/previews/primer/forms/forms_preview.rb +2 -0
- data/static/arguments.json +118 -118
- data/static/audited_at.json +6 -0
- data/static/constants.json +67 -54
- data/static/statuses.json +12 -6
- metadata +36 -23
- data/app/components/primer/state_component.css.json +0 -1
- data/app/components/primer/state_component.css.map +0 -1
- data/app/components/primer/subhead_component.css.json +0 -1
- data/app/components/primer/subhead_component.css.map +0 -1
- data/app/components/primer/timeline_item_component.css.json +0 -1
- data/app/components/primer/timeline_item_component.css.map +0 -1
- data/previews/primer/hellip_button_preview.rb +0 -22
- data/previews/primer/state_component_preview.rb +0 -26
- data/previews/primer/subhead_component_preview.rb +0 -40
- data/previews/primer/timeline_item_component_preview.rb +0 -28
@@ -10,47 +10,47 @@ module Primer
|
|
10
10
|
# @param scheme [Symbol] select [default, neutral, info, warning]
|
11
11
|
def playground(padding: :default, scheme: :default)
|
12
12
|
render(Primer::Beta::BorderBox.new(padding: padding)) do |component|
|
13
|
-
component.
|
14
|
-
component.
|
15
|
-
component.
|
16
|
-
component.
|
17
|
-
component.
|
18
|
-
component.
|
13
|
+
component.with_header { "Header" }
|
14
|
+
component.with_body { "Body" }
|
15
|
+
component.with_row(scheme: scheme) { "#{scheme.to_s.capitalize} row one" }
|
16
|
+
component.with_row(scheme: scheme) { "#{scheme.to_s.capitalize} row two" }
|
17
|
+
component.with_row(scheme: scheme) { "#{scheme.to_s.capitalize} row three" }
|
18
|
+
component.with_footer { "Footer" }
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
# @label Default
|
23
23
|
def default
|
24
24
|
render(Primer::Beta::BorderBox.new) do |component|
|
25
|
-
component.
|
26
|
-
component.
|
27
|
-
component.
|
28
|
-
component.
|
29
|
-
component.
|
30
|
-
component.
|
25
|
+
component.with_header { "Header" }
|
26
|
+
component.with_body { "Body" }
|
27
|
+
component.with_row { "Row one" }
|
28
|
+
component.with_row { "Row two" }
|
29
|
+
component.with_row { "Row three" }
|
30
|
+
component.with_footer { "Footer" }
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
# @label Header with title
|
35
35
|
def header_with_title
|
36
36
|
render(Primer::Beta::BorderBox.new) do |component|
|
37
|
-
component.with_header do |
|
38
|
-
|
37
|
+
component.with_header do |header|
|
38
|
+
header.with_title(tag: :h2) do
|
39
39
|
"Header with title"
|
40
40
|
end
|
41
41
|
end
|
42
|
-
component.
|
43
|
-
component.
|
42
|
+
component.with_body { "Body" }
|
43
|
+
component.with_footer { "Footer" }
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
# @label Row colors
|
48
48
|
def row_colors
|
49
49
|
render(Primer::Beta::BorderBox.new) do |component|
|
50
|
-
component.
|
51
|
-
component.
|
52
|
-
component.
|
53
|
-
component.
|
50
|
+
component.with_row(scheme: :default) { "Default" }
|
51
|
+
component.with_row(scheme: :neutral) { "Neutral" }
|
52
|
+
component.with_row(scheme: :info) { "Info" }
|
53
|
+
component.with_row(scheme: :warning) { "Warning" }
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -59,36 +59,36 @@ module Primer
|
|
59
59
|
# @label Default
|
60
60
|
def padding_default
|
61
61
|
render(Primer::Beta::BorderBox.new) do |component|
|
62
|
-
component.
|
63
|
-
component.
|
64
|
-
component.
|
65
|
-
component.
|
66
|
-
component.
|
67
|
-
component.
|
62
|
+
component.with_header { "Header" }
|
63
|
+
component.with_body { "Body" }
|
64
|
+
component.with_row { "Row one" }
|
65
|
+
component.with_row { "Row two" }
|
66
|
+
component.with_row { "Row three" }
|
67
|
+
component.with_footer { "Footer" }
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
# @label Condensed
|
72
72
|
def padding_condensed
|
73
73
|
render(Primer::Beta::BorderBox.new(padding: :condensed)) do |component|
|
74
|
-
component.
|
75
|
-
component.
|
76
|
-
component.
|
77
|
-
component.
|
78
|
-
component.
|
79
|
-
component.
|
74
|
+
component.with_header { "Header" }
|
75
|
+
component.with_body { "Body" }
|
76
|
+
component.with_row { "Row one" }
|
77
|
+
component.with_row { "Row two" }
|
78
|
+
component.with_row { "Row three" }
|
79
|
+
component.with_footer { "Footer" }
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
83
|
# @label Spacious
|
84
84
|
def padding_spacious
|
85
85
|
render(Primer::Beta::BorderBox.new(padding: :spacious)) do |component|
|
86
|
-
component.
|
87
|
-
component.
|
88
|
-
component.
|
89
|
-
component.
|
90
|
-
component.
|
91
|
-
component.
|
86
|
+
component.with_header { "Header" }
|
87
|
+
component.with_body { "Body" }
|
88
|
+
component.with_row { "Row one" }
|
89
|
+
component.with_row { "Row two" }
|
90
|
+
component.with_row { "Row three" }
|
91
|
+
component.with_footer { "Footer" }
|
92
92
|
end
|
93
93
|
end
|
94
94
|
#
|
@@ -10,7 +10,7 @@ module Primer
|
|
10
10
|
def playground(number_of_links: 2)
|
11
11
|
render(Primer::Beta::Breadcrumbs.new) do |component|
|
12
12
|
Array.new(number_of_links || 3) do |i|
|
13
|
-
component.
|
13
|
+
component.with_item(href: "##{i}") { "Breadcrumb Item #{i + 1}" }
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -21,7 +21,7 @@ module Primer
|
|
21
21
|
def default(number_of_links: 2)
|
22
22
|
render(Primer::Beta::Breadcrumbs.new) do |component|
|
23
23
|
Array.new(number_of_links || 3) do |i|
|
24
|
-
component.
|
24
|
+
component.with_item(href: "##{i}") { "Breadcrumb Item #{i + 1}" }
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -8,11 +8,11 @@ module Primer
|
|
8
8
|
#
|
9
9
|
# @param size [Symbol] select [medium, small]
|
10
10
|
def playground(size: :medium)
|
11
|
-
render(Primer::Beta::ButtonGroup.new(size: size)) do |
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
render(Primer::Beta::ButtonGroup.new(size: size)) do |component|
|
12
|
+
component.with_button { "Button" }
|
13
|
+
component.with_button(scheme: :primary) { "Primary" }
|
14
|
+
component.with_button(scheme: :danger) { "Danger" }
|
15
|
+
component.with_button(scheme: :outline) { "Outline" }
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -20,11 +20,11 @@ module Primer
|
|
20
20
|
#
|
21
21
|
# @param size [Symbol] select [medium, small]
|
22
22
|
def default(size: :medium)
|
23
|
-
render(Primer::Beta::ButtonGroup.new(size: size)) do |
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
render(Primer::Beta::ButtonGroup.new(size: size)) do |component|
|
24
|
+
component.with_button { "Button" }
|
25
|
+
component.with_button(scheme: :primary) { "Primary" }
|
26
|
+
component.with_button(scheme: :danger) { "Danger" }
|
27
|
+
component.with_button(scheme: :outline) { "Outline" }
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -2,25 +2,25 @@
|
|
2
2
|
<%= render(Primer::Beta::Button.new(
|
3
3
|
scheme: :secondary,
|
4
4
|
size: :medium,
|
5
|
-
)) do
|
5
|
+
)) do %>
|
6
6
|
Button
|
7
7
|
<% end %>
|
8
8
|
<%= render(Primer::Beta::Button.new(
|
9
9
|
scheme: :primary,
|
10
10
|
size: :medium,
|
11
|
-
)) do
|
11
|
+
)) do %>
|
12
12
|
Button
|
13
13
|
<% end %>
|
14
14
|
<%= render(Primer::Beta::Button.new(
|
15
15
|
scheme: :invisible,
|
16
16
|
size: :medium,
|
17
|
-
)) do
|
17
|
+
)) do %>
|
18
18
|
Button
|
19
19
|
<% end %>
|
20
20
|
<%= render(Primer::Beta::Button.new(
|
21
21
|
scheme: :danger,
|
22
22
|
size: :medium,
|
23
|
-
)) do
|
23
|
+
)) do %>
|
24
24
|
Button
|
25
25
|
<% end %>
|
26
26
|
</div>
|
@@ -2,53 +2,53 @@
|
|
2
2
|
<%= render(Primer::Beta::Button.new(
|
3
3
|
scheme: :invisible,
|
4
4
|
size: :medium,
|
5
|
-
)) do
|
5
|
+
)) do %>
|
6
6
|
Button
|
7
7
|
<% end %>
|
8
8
|
<%= render(Primer::Beta::Button.new(
|
9
9
|
scheme: :invisible,
|
10
10
|
size: :medium,
|
11
|
-
)) do |
|
12
|
-
<%
|
11
|
+
)) do |component| %>
|
12
|
+
<% component.with_leading_visual_icon(icon: :search) %>
|
13
13
|
Button
|
14
14
|
<% end %>
|
15
15
|
<%= render(Primer::Beta::Button.new(
|
16
16
|
scheme: :invisible,
|
17
17
|
size: :medium,
|
18
|
-
)) do |
|
19
|
-
<%
|
18
|
+
)) do |component| %>
|
19
|
+
<% component.with_trailing_action_icon(icon: "triangle-down") %>
|
20
20
|
Button
|
21
21
|
<% end %>
|
22
22
|
<%= render(Primer::Beta::Button.new(
|
23
23
|
scheme: :invisible,
|
24
24
|
size: :medium,
|
25
|
-
)) do |
|
26
|
-
<%
|
25
|
+
)) do |component| %>
|
26
|
+
<% component.with_trailing_visual_counter(count: "15") %>
|
27
27
|
Button
|
28
28
|
<% end %>
|
29
29
|
<%= render(Primer::Beta::Button.new(
|
30
30
|
scheme: :invisible,
|
31
31
|
size: :medium,
|
32
|
-
)) do |
|
33
|
-
<%
|
34
|
-
<%
|
32
|
+
)) do |component| %>
|
33
|
+
<% component.with_leading_visual_icon(icon: :eye) %>
|
34
|
+
<% component.with_trailing_visual_counter(count: "15") %>
|
35
35
|
Button
|
36
36
|
<% end %>
|
37
37
|
<%= render(Primer::Beta::Button.new(
|
38
38
|
scheme: :invisible,
|
39
39
|
size: :medium,
|
40
|
-
)) do |
|
41
|
-
<%
|
42
|
-
<%
|
43
|
-
<%
|
40
|
+
)) do |component| %>
|
41
|
+
<% component.with_leading_visual_icon(icon: :eye) %>
|
42
|
+
<% component.with_trailing_visual_counter(count: "15") %>
|
43
|
+
<% component.with_trailing_action_icon(icon: "triangle-down") %>
|
44
44
|
Button
|
45
45
|
<% end %>
|
46
46
|
<%= render(Primer::Beta::Button.new(
|
47
47
|
scheme: :invisible,
|
48
48
|
size: :medium,
|
49
49
|
id: "my-id"
|
50
|
-
)) do |
|
51
|
-
<%
|
50
|
+
)) do |component| %>
|
51
|
+
<% component.with_tooltip(text: "Tooltip text") %>
|
52
52
|
Button with tooltip
|
53
53
|
<% end %>
|
54
54
|
</div>
|
@@ -9,11 +9,11 @@ module Primer
|
|
9
9
|
# @param overlay [Symbol] select [none, default, dark]
|
10
10
|
# @param reset [Boolean] toggle
|
11
11
|
def playground(reset: false, overlay: :default)
|
12
|
-
render Primer::Beta::Details.new(reset: reset, overlay: overlay) do |
|
13
|
-
|
12
|
+
render Primer::Beta::Details.new(reset: reset, overlay: overlay) do |component|
|
13
|
+
component.with_summary do
|
14
14
|
"Summary"
|
15
15
|
end
|
16
|
-
|
16
|
+
component.with_body do
|
17
17
|
"Body"
|
18
18
|
end
|
19
19
|
end
|
@@ -24,11 +24,11 @@ module Primer
|
|
24
24
|
# @param overlay [Symbol] select [none, default, dark]
|
25
25
|
# @param reset [Boolean] toggle
|
26
26
|
def default(reset: false, overlay: :default)
|
27
|
-
render Primer::Beta::Details.new(reset: reset, overlay: overlay) do |
|
28
|
-
|
27
|
+
render Primer::Beta::Details.new(reset: reset, overlay: overlay) do |component|
|
28
|
+
component.with_summary do
|
29
29
|
"Summary"
|
30
30
|
end
|
31
|
-
|
31
|
+
component.with_body do
|
32
32
|
"Body"
|
33
33
|
end
|
34
34
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Beta
|
5
|
+
# @label State
|
6
|
+
class StatePreview < ViewComponent::Preview
|
7
|
+
# @label Playground
|
8
|
+
#
|
9
|
+
# @param title [String]
|
10
|
+
# @param tag [Symbol] select [span, div]
|
11
|
+
# @param size [Symbol] select [default, small]
|
12
|
+
# @param scheme [Symbol] select [default, open, closed, merged]
|
13
|
+
def playground(title: "State", scheme: :default, size: :default, tag: :span)
|
14
|
+
render(Primer::Beta::State.new(title: title, scheme: scheme, size: size, tag: tag)) { "State" }
|
15
|
+
end
|
16
|
+
|
17
|
+
# @label Default
|
18
|
+
#
|
19
|
+
# @param title [String]
|
20
|
+
# @param tag [Symbol] select [span, div]
|
21
|
+
# @param size [Symbol] select [default, small]
|
22
|
+
# @param scheme [Symbol] select [default, open, closed, merged]
|
23
|
+
def default(title: "State", scheme: :default, size: :default, tag: :span)
|
24
|
+
render(Primer::Beta::State.new(title: title, scheme: scheme, size: size, tag: tag)) { "State" }
|
25
|
+
end
|
26
|
+
|
27
|
+
# @!group States
|
28
|
+
#
|
29
|
+
# @label Default
|
30
|
+
def states_default
|
31
|
+
render(Primer::Beta::State.new(title: "Default")) { "Default state" }
|
32
|
+
end
|
33
|
+
|
34
|
+
# @label Open
|
35
|
+
def states_open
|
36
|
+
render(Primer::Beta::State.new(title: "Open", scheme: :open)) { "Open state" }
|
37
|
+
end
|
38
|
+
|
39
|
+
# @label Closed
|
40
|
+
def states_closed
|
41
|
+
render(Primer::Beta::State.new(title: "Closed", scheme: :closed)) { "Closed state" }
|
42
|
+
end
|
43
|
+
|
44
|
+
# @label Merged
|
45
|
+
def states_merged
|
46
|
+
render(Primer::Beta::State.new(title: "Merged", scheme: :merged)) { "Merged state" }
|
47
|
+
end
|
48
|
+
#
|
49
|
+
# @!endgroup
|
50
|
+
|
51
|
+
# @!group Sizes
|
52
|
+
#
|
53
|
+
# @label Default
|
54
|
+
def sizes_default
|
55
|
+
render(Primer::Beta::State.new(title: "Default")) { "Default size" }
|
56
|
+
end
|
57
|
+
|
58
|
+
# @label Small
|
59
|
+
def sizes_small
|
60
|
+
render(Primer::Beta::State.new(title: "Default", size: :small)) { "Small size" }
|
61
|
+
end
|
62
|
+
#
|
63
|
+
# @!endgroup
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%= render(Primer::Beta::Subhead.new) do |component| %>
|
2
|
+
<% component.with_heading do %>
|
3
|
+
A Heading
|
4
|
+
<% end %>
|
5
|
+
<% component.with_description do %>
|
6
|
+
A description with actions
|
7
|
+
<% end %>
|
8
|
+
<% component.with_actions do %>
|
9
|
+
<% render(Primer::Beta::Button.new(scheme: :primary)) do %>
|
10
|
+
An action
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Beta
|
5
|
+
# @label Subhead
|
6
|
+
class SubheadPreview < ViewComponent::Preview
|
7
|
+
# @label Playground
|
8
|
+
#
|
9
|
+
# @param spacious [Boolean]
|
10
|
+
# @param hide_border [Boolean]
|
11
|
+
# @param heading_danger [Boolean]
|
12
|
+
# @param heading_tag [Symbol] select [div, h1, h2, h3, h4, h5, h6]
|
13
|
+
def playground(spacious: false, hide_border: false, heading_tag: :div, heading_danger: false)
|
14
|
+
render(Primer::Beta::Subhead.new(spacious: spacious, hide_border: hide_border)) do |component|
|
15
|
+
component.with_heading(tag: heading_tag, danger: heading_danger) do
|
16
|
+
"My Heading"
|
17
|
+
end
|
18
|
+
component.with_description do
|
19
|
+
"My Description"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# @label Default Options
|
25
|
+
#
|
26
|
+
# @param spacious [Boolean]
|
27
|
+
# @param hide_border [Boolean]
|
28
|
+
# @param heading_danger [Boolean]
|
29
|
+
# @param heading_tag [Symbol] select [div, h1, h2, h3, h4, h5, h6]
|
30
|
+
def default(spacious: false, hide_border: false, heading_tag: :div, heading_danger: false)
|
31
|
+
render(Primer::Beta::Subhead.new(spacious: spacious, hide_border: hide_border)) do |component|
|
32
|
+
component.with_heading(tag: heading_tag, danger: heading_danger) do
|
33
|
+
"My Heading"
|
34
|
+
end
|
35
|
+
component.with_description do
|
36
|
+
"My Description"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# @label Danger
|
42
|
+
def danger
|
43
|
+
render(Primer::Beta::Subhead.new) do |component|
|
44
|
+
component.with_heading(danger: true) do
|
45
|
+
"Danger Heading"
|
46
|
+
end
|
47
|
+
component.with_description do
|
48
|
+
"A description of the 'danger'"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# @label Actions
|
54
|
+
def actions
|
55
|
+
render_with_template(locals: {})
|
56
|
+
end
|
57
|
+
|
58
|
+
# @!group Spacing
|
59
|
+
#
|
60
|
+
# @label Default
|
61
|
+
def spacing_default
|
62
|
+
render(Primer::Beta::Subhead.new(spacious: false)) do |component|
|
63
|
+
component.with_heading do
|
64
|
+
"Default Spacing"
|
65
|
+
end
|
66
|
+
component.with_description do
|
67
|
+
"Default spacing above the component"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# @label Spacious
|
73
|
+
def spacing_spacious
|
74
|
+
render(Primer::Beta::Subhead.new(spacious: true)) do |component|
|
75
|
+
component.with_heading do
|
76
|
+
"Spacious"
|
77
|
+
end
|
78
|
+
component.with_description do
|
79
|
+
"With extra space above the component"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# @label Spacious w/ Danger Heading
|
85
|
+
def spacing_dangerous
|
86
|
+
render(Primer::Beta::Subhead.new(spacious: true)) do |component|
|
87
|
+
component.with_heading(danger: true) do
|
88
|
+
"Danger Heading"
|
89
|
+
end
|
90
|
+
component.with_description do
|
91
|
+
"With extra space above the component, and a 'danger' heading"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
#
|
96
|
+
# @!endgroup
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Beta
|
5
|
+
# @label TimelineItem
|
6
|
+
class TimelineItemPreview < ViewComponent::Preview
|
7
|
+
# @label Playground
|
8
|
+
#
|
9
|
+
# @param condensed [Boolean]
|
10
|
+
def playground(condensed: false)
|
11
|
+
render(Primer::Beta::TimelineItem.new(condensed: condensed)) do |component|
|
12
|
+
component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "octocat")
|
13
|
+
component.with_badge(bg: :success_emphasis, color: :on_emphasis, icon: :check)
|
14
|
+
component.with_body { "Success!" }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# @label Default
|
19
|
+
#
|
20
|
+
# @param condensed [Boolean]
|
21
|
+
def default(condensed: false)
|
22
|
+
render(Primer::Beta::TimelineItem.new(condensed: condensed)) do |component|
|
23
|
+
component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "octocat")
|
24
|
+
component.with_badge(bg: :success_emphasis, color: :on_emphasis, icon: :check)
|
25
|
+
component.with_body { "Success!" }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render(ExampleToggleSwitchForm.new(csrf: "let_me_in", src: toggle_switch_index_path)) %>
|