primer_view_components 0.0.18 → 0.0.19
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 +4 -4
- data/CHANGELOG.md +38 -0
- data/app/components/primer/avatar_component.rb +24 -6
- data/app/components/primer/avatar_stack_component.html.erb +10 -0
- data/app/components/primer/avatar_stack_component.rb +81 -0
- data/app/components/primer/base_component.rb +3 -3
- data/app/components/primer/blankslate_component.rb +8 -8
- data/app/components/primer/border_box_component.rb +29 -17
- data/app/components/primer/box_component.rb +2 -2
- data/app/components/primer/breadcrumb_component.rb +1 -1
- data/app/components/primer/button_component.rb +2 -2
- data/app/components/primer/button_group_component.rb +4 -1
- data/app/components/primer/button_marketing_component.rb +2 -2
- data/app/components/primer/component.rb +5 -6
- data/app/components/primer/counter_component.rb +5 -1
- data/app/components/primer/dropdown/menu_component.html.erb +12 -0
- data/app/components/primer/dropdown/menu_component.rb +48 -0
- data/app/components/primer/dropdown_component.html.erb +9 -0
- data/app/components/primer/dropdown_component.rb +77 -0
- data/app/components/primer/dropdown_menu_component.rb +4 -0
- data/app/components/primer/flash_component.rb +10 -6
- data/app/components/primer/flex_component.rb +38 -1
- data/app/components/primer/flex_item_component.rb +15 -1
- data/app/components/primer/heading_component.rb +1 -1
- data/app/components/primer/label_component.rb +2 -2
- data/app/components/primer/layout_component.rb +2 -2
- data/app/components/primer/link_component.rb +6 -2
- data/app/components/primer/markdown_component.rb +293 -0
- data/app/components/primer/menu_component.html.erb +6 -0
- data/app/components/primer/menu_component.rb +71 -0
- data/app/components/primer/octicon_component.rb +7 -3
- data/app/components/primer/popover_component.rb +5 -5
- data/app/components/primer/progress_bar_component.rb +5 -5
- data/app/components/primer/spinner_component.rb +7 -3
- data/app/components/primer/state_component.rb +3 -3
- data/app/components/primer/subhead_component.rb +6 -6
- data/app/components/primer/text_component.rb +1 -1
- data/app/components/primer/timeline_item_component.rb +4 -4
- data/app/components/primer/tooltip_component.rb +5 -5
- data/app/components/primer/truncate_component.rb +4 -4
- data/app/components/primer/underline_nav_component.rb +2 -2
- data/app/components/primer/view_components.rb +4 -0
- data/lib/primer/classify.rb +22 -9
- data/lib/primer/classify/cache.rb +125 -0
- data/lib/primer/fetch_or_fallback_helper.rb +1 -1
- data/lib/primer/join_style_arguments_helper.rb +1 -1
- data/lib/primer/view_components.rb +32 -1
- data/lib/primer/view_components/engine.rb +1 -1
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/yard/renders_many_handler.rb +19 -0
- data/lib/yard/renders_one_handler.rb +19 -0
- data/static/statuses.json +1 -0
- metadata +46 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2123d6cd3a227f0cf3df93cc601098dc6e6b0b59ba98bbc589ccdd6a4c8b0b4f
|
4
|
+
data.tar.gz: b8b5075b18d79f10a385bb51b6f2d17d324a10fb3c5c5c961e841f96713a8c59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5ce375e1b8fa9d95cd784ea19565a6bfeb1024db7fdc5e010995f2a7085f5b03cfa163979c7b33648eacfd986b4339b1ca1bdba06e5ba581b8b20a006935d62
|
7
|
+
data.tar.gz: 0d6124a56d36eb09075d4be8bc50b8d1e061c2e9137c030733f6b875488f3f15e0939dd5692116e7f2d29cc7ac81ed6adc5f27cdb442e57ad44b8d456e5c60cc
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,44 @@
|
|
2
2
|
|
3
3
|
## main
|
4
4
|
|
5
|
+
## 0.0.19
|
6
|
+
|
7
|
+
* Add support for functional colors to `color` system argument.
|
8
|
+
|
9
|
+
*Jake Shorty
|
10
|
+
|
11
|
+
* Add `AvatarStack`, `Dropdown`, `Markdown` and `Menu` components.
|
12
|
+
|
13
|
+
*Manuel Puyol*
|
14
|
+
|
15
|
+
* Deprecate `DropdownMenuComponent`.
|
16
|
+
|
17
|
+
*Manuel Puyol*
|
18
|
+
|
19
|
+
* Fix `Avatar` bug when used with links.
|
20
|
+
|
21
|
+
*Manuel Puyol*
|
22
|
+
|
23
|
+
* Add cache for common Primer values.
|
24
|
+
|
25
|
+
*Blake Williams*
|
26
|
+
|
27
|
+
* Add support for `octicons_helper` v12.
|
28
|
+
|
29
|
+
*Cole Bemis*
|
30
|
+
|
31
|
+
* Add support for `border: true` to apply the `border` class.
|
32
|
+
|
33
|
+
*Simon Taranto*
|
34
|
+
|
35
|
+
* Promote `Avatar`, `Link`, and `Counter` components to beta.
|
36
|
+
|
37
|
+
*Simon Taranto*
|
38
|
+
|
39
|
+
* **Breaking change**: Drop support for Ruby 2.4.
|
40
|
+
|
41
|
+
*Simon Taranto*
|
42
|
+
|
5
43
|
## 0.0.18
|
6
44
|
|
7
45
|
* Add `border_radius` system argument.
|
@@ -7,15 +7,23 @@ module Primer
|
|
7
7
|
class AvatarComponent < Primer::Component
|
8
8
|
SMALL_THRESHOLD = 24
|
9
9
|
|
10
|
-
#
|
11
|
-
# @example 34|Default
|
10
|
+
# @example auto|Default
|
12
11
|
# <%= render(Primer::AvatarComponent.new(src: "http://placekitten.com/200/200", alt: "@kittenuser")) %>
|
13
12
|
#
|
13
|
+
# @example auto|Square
|
14
|
+
# <%= render(Primer::AvatarComponent.new(src: "http://placekitten.com/200/200", alt: "@kittenuser", square: true)) %>
|
15
|
+
#
|
16
|
+
# @example auto|Link
|
17
|
+
# <%= render(Primer::AvatarComponent.new(href: "#", src: "http://placekitten.com/200/200", alt: "@kittenuser")) %>
|
18
|
+
#
|
14
19
|
# @param src [String] The source url of the avatar image
|
15
20
|
# @param alt [String] Passed through to alt on img tag
|
16
21
|
# @param size [Integer] Adds the avatar-small class if less than 24
|
17
22
|
# @param square [Boolean] Used to create a square avatar.
|
18
|
-
|
23
|
+
# @param href [String] The URL to link to. If used, component will be wrapped by an `<a>` tag
|
24
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
25
|
+
def initialize(src:, alt:, size: 20, square: false, href: nil, **system_arguments)
|
26
|
+
@href = href
|
19
27
|
@system_arguments = system_arguments
|
20
28
|
@system_arguments[:tag] = :img
|
21
29
|
@system_arguments[:src] = src
|
@@ -25,15 +33,25 @@ module Primer
|
|
25
33
|
@system_arguments[:width] = size
|
26
34
|
|
27
35
|
@system_arguments[:classes] = class_names(
|
28
|
-
"avatar",
|
29
36
|
system_arguments[:classes],
|
37
|
+
"avatar" => !href,
|
30
38
|
"avatar--small" => size < SMALL_THRESHOLD,
|
31
|
-
"
|
39
|
+
"circle" => !square
|
32
40
|
)
|
33
41
|
end
|
34
42
|
|
35
43
|
def call
|
36
|
-
|
44
|
+
if @href
|
45
|
+
render(Primer::LinkComponent.new(href: @href, classes: "avatar")) do
|
46
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
47
|
+
end
|
48
|
+
else
|
49
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.status
|
54
|
+
Primer::Component::STATUSES[:beta]
|
37
55
|
end
|
38
56
|
end
|
39
57
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
|
2
|
+
<%= render body_component do %>
|
3
|
+
<% avatars.each_with_index do |avatar, i| %>
|
4
|
+
<% if i == 2 %>
|
5
|
+
<div class="avatar avatar-more"></div>
|
6
|
+
<% end %>
|
7
|
+
<%= avatar %>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
# Use AvatarStack to stack multiple avatars together.
|
5
|
+
class AvatarStackComponent < Primer::Component
|
6
|
+
include ViewComponent::SlotableV2
|
7
|
+
|
8
|
+
ALIGN_DEFAULT = :left
|
9
|
+
ALIGN_OPTIONS = [ALIGN_DEFAULT, :right].freeze
|
10
|
+
|
11
|
+
# Required list of stacked avatars.
|
12
|
+
#
|
13
|
+
# @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::AvatarComponent) %>.
|
14
|
+
renders_many :avatars, Primer::AvatarComponent
|
15
|
+
|
16
|
+
# @example auto|Default
|
17
|
+
# <%= render(Primer::AvatarStackComponent.new) do |c| %>
|
18
|
+
# <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
|
19
|
+
# <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
|
20
|
+
# <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
|
21
|
+
# <% end %>
|
22
|
+
#
|
23
|
+
# @example auto|Align right
|
24
|
+
# <%= render(Primer::AvatarStackComponent.new(align: :right)) do |c| %>
|
25
|
+
# <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
|
26
|
+
# <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
|
27
|
+
# <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
|
28
|
+
# <% end %>
|
29
|
+
#
|
30
|
+
# @example auto|With tooltip
|
31
|
+
# <%= render(Primer::AvatarStackComponent.new(tooltipped: true, body_arguments: { label: 'This is a tooltip!' })) do |c| %>
|
32
|
+
# <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
|
33
|
+
# <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
|
34
|
+
# <%= c.avatar(src: "http://placekitten.com/200/200", alt: "@kittenuser") %>
|
35
|
+
# <% end %>
|
36
|
+
#
|
37
|
+
# @param align [Symbol] <%= one_of(Primer::AvatarStackComponent::ALIGN_OPTIONS) %>
|
38
|
+
# @param tooltipped [Boolean] Whether to add a tooltip to the stack or not.
|
39
|
+
# @param body_arguments [Hash] Parameters to add to the Body. If `tooltipped` is set, has the same arguments as <%= link_to_component(Primer::TooltipComponent) %>.
|
40
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
41
|
+
def initialize(align: ALIGN_DEFAULT, tooltipped: false, body_arguments: {}, **system_arguments)
|
42
|
+
@align = fetch_or_fallback(ALIGN_OPTIONS, align, ALIGN_DEFAULT)
|
43
|
+
@system_arguments = system_arguments
|
44
|
+
@tooltipped = tooltipped
|
45
|
+
@body_arguments = body_arguments
|
46
|
+
|
47
|
+
@body_arguments[:tag] ||= :div
|
48
|
+
@body_arguments[:classes] = class_names(
|
49
|
+
"AvatarStack-body",
|
50
|
+
@body_arguments[:classes]
|
51
|
+
)
|
52
|
+
|
53
|
+
@system_arguments[:tag] ||= :div
|
54
|
+
@system_arguments[:classes] = class_names(
|
55
|
+
"AvatarStack",
|
56
|
+
system_arguments[:classes],
|
57
|
+
"AvatarStack--right" => @align == :right
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
def body_component
|
62
|
+
if @tooltipped
|
63
|
+
Primer::TooltipComponent.new(**@body_arguments)
|
64
|
+
else
|
65
|
+
Primer::BaseComponent.new(**@body_arguments)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def before_render
|
70
|
+
@system_arguments[:classes] = class_names(
|
71
|
+
@system_arguments[:classes],
|
72
|
+
"AvatarStack--two" => avatars.size == 2,
|
73
|
+
"AvatarStack--three-plus" => avatars.size > 2
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
def render?
|
78
|
+
avatars.any?
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -76,11 +76,11 @@ module Primer
|
|
76
76
|
#
|
77
77
|
# @param underline [Boolean] Whether text should be underlined.
|
78
78
|
#
|
79
|
-
# @param color [Symbol] Text color. <%= one_of([:blue, :red, :gray_light, :gray, :gray_dark, :green, :orange, :orange_light, :purple, :pink, :white, :inherit
|
79
|
+
# @param color [Symbol] Text color. <%= one_of([:blue, :red, :gray_light, :gray, :gray_dark, :green, :orange, :orange_light, :purple, :pink, :white, :inherit, :text_primary, :text_secondary, :text_tertiary, :text_link, :text_success, :text_warning, :text_danger, :icon_primary, :icon_secondary, :icon_tertiary, :icon_info, :icon_success, :icon_warning, :icon_danger]) %>
|
80
80
|
# @param bg [String, Symbol] Background color. Accepts either a hex value as a String or a color name as a Symbol.
|
81
81
|
#
|
82
82
|
# @param box_shadow [Boolean, Symbol] Box shadow. <%= one_of([true, :medium, :large, :extra_large, :none]) %>
|
83
|
-
# @param border [Symbol] <%= one_of([:left, :top, :bottom, :right, :y, :x]) %>
|
83
|
+
# @param border [Symbol] <%= one_of([:left, :top, :bottom, :right, :y, :x, true]) %>
|
84
84
|
# @param border_color [Symbol] <%= one_of([:blue, :blue_light, :gray, :gray_dark, :green, :purple, :red, :red_light, :white, :yellow, :black_fade]) %> Note: this API is subject to change as we move to functional colors.
|
85
85
|
# @param border_top [Integer] Set to `0` to remove the top border.
|
86
86
|
# @param border_bottom [Integer] Set to `0` to remove the bottom border.
|
@@ -116,7 +116,7 @@ module Primer
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def call
|
119
|
-
content_tag(@tag, content,
|
119
|
+
content_tag(@tag, content, @content_tag_args.merge(@result))
|
120
120
|
end
|
121
121
|
|
122
122
|
private
|
@@ -8,20 +8,20 @@ module Primer
|
|
8
8
|
with_slot :spinner, class_name: "Spinner"
|
9
9
|
|
10
10
|
#
|
11
|
-
# @example
|
11
|
+
# @example auto|Basic
|
12
12
|
# <%= render Primer::BlankslateComponent.new(
|
13
13
|
# title: "Title",
|
14
14
|
# description: "Description",
|
15
15
|
# ) %>
|
16
16
|
#
|
17
|
-
# @example
|
17
|
+
# @example auto|Icon|Add an `icon` to give additional context. Refer to the [Octicons](https://primer.style/octicons/) documentation to choose an icon.
|
18
18
|
# <%= render Primer::BlankslateComponent.new(
|
19
19
|
# icon: "octoface",
|
20
20
|
# title: "Title",
|
21
21
|
# description: "Description",
|
22
22
|
# ) %>
|
23
23
|
#
|
24
|
-
# @example
|
24
|
+
# @example auto|Loading|Add a [SpinnerComponent](https://primer.style/view-components/components/spinner) to the blankslate in place of an icon.
|
25
25
|
# <%= render Primer::BlankslateComponent.new(
|
26
26
|
# title: "Title",
|
27
27
|
# description: "Description",
|
@@ -29,14 +29,14 @@ module Primer
|
|
29
29
|
# <% component.slot(:spinner, size: :large) %>
|
30
30
|
# <% end %>
|
31
31
|
#
|
32
|
-
# @example
|
32
|
+
# @example auto|Custom content|Pass custom content as a block in place of `description`.
|
33
33
|
# <%= render Primer::BlankslateComponent.new(
|
34
34
|
# title: "Title",
|
35
35
|
# ) do %>
|
36
36
|
# <em>Your custom content here</em>
|
37
37
|
# <% end %>
|
38
38
|
#
|
39
|
-
# @example
|
39
|
+
# @example auto|Action button|Provide a button to guide users to take action from the blankslate. The button appears below the description and custom content.
|
40
40
|
# <%= render Primer::BlankslateComponent.new(
|
41
41
|
# icon: "book",
|
42
42
|
# title: "Welcome to the mona wiki!",
|
@@ -46,7 +46,7 @@ module Primer
|
|
46
46
|
# button_url: "https://github.com/monalisa/mona/wiki/_new",
|
47
47
|
# ) %>
|
48
48
|
#
|
49
|
-
# @example
|
49
|
+
# @example auto|Link|Add an additional link to help users learn more about a feature. The link will be shown at the very bottom:
|
50
50
|
# <%= render Primer::BlankslateComponent.new(
|
51
51
|
# icon: "book",
|
52
52
|
# title: "Welcome to the mona wiki!",
|
@@ -55,7 +55,7 @@ module Primer
|
|
55
55
|
# link_url: "https://docs.github.com/en/github/building-a-strong-community/about-wikis",
|
56
56
|
# ) %>
|
57
57
|
#
|
58
|
-
# @example
|
58
|
+
# @example auto|Variations|There are a few variations of how the Blankslate appears: `narrow` adds a maximum width, `large` increases the font size, and `spacious` adds extra padding.
|
59
59
|
# <%= render Primer::BlankslateComponent.new(
|
60
60
|
# icon: "book",
|
61
61
|
# title: "Welcome to the mona wiki!",
|
@@ -125,7 +125,7 @@ module Primer
|
|
125
125
|
@link_url = link_url
|
126
126
|
end
|
127
127
|
|
128
|
-
# :nodoc
|
128
|
+
# :nodoc:
|
129
129
|
class Spinner < Primer::Slot
|
130
130
|
# @param size [Symbol] <%= one_of(Primer::SpinnerComponent::SIZE_MAPPINGS) %>
|
131
131
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -10,31 +10,43 @@ module Primer
|
|
10
10
|
with_slot :footer, class_name: "Footer"
|
11
11
|
with_slot :row, collection: true, class_name: "Row"
|
12
12
|
|
13
|
-
# @example
|
14
|
-
# <%= render(Primer::BorderBoxComponent.new) do |component|
|
15
|
-
# component.slot(:header)
|
16
|
-
#
|
17
|
-
#
|
18
|
-
# component.slot(:
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
13
|
+
# @example auto|Header, body, rows, and footer
|
14
|
+
# <%= render(Primer::BorderBoxComponent.new) do |component| %>
|
15
|
+
# <% component.slot(:header) do %>
|
16
|
+
# Header
|
17
|
+
# <% end %>
|
18
|
+
# <% component.slot(:body) do %>
|
19
|
+
# Body
|
20
|
+
# <% end %>
|
21
|
+
# <% component.slot(:row) do %>
|
22
|
+
# <% if true %>
|
23
|
+
# Row one
|
24
|
+
# <% end %>
|
25
|
+
# <% end %>
|
26
|
+
# <% component.slot(:row) do %>
|
27
|
+
# Row two
|
28
|
+
# <% end %>
|
29
|
+
# <% component.slot(:footer) do %>
|
30
|
+
# Footer
|
31
|
+
# <% end %>
|
32
|
+
# <% end %>
|
22
33
|
#
|
23
34
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
24
35
|
def initialize(**system_arguments)
|
25
36
|
@system_arguments = system_arguments
|
26
37
|
@system_arguments[:tag] = :div
|
27
|
-
@system_arguments[:classes] = class_names(
|
28
|
-
"Box",
|
29
|
-
system_arguments[:classes]
|
30
|
-
)
|
38
|
+
@system_arguments[:classes] = class_names("Box", system_arguments[:classes])
|
31
39
|
end
|
32
40
|
|
33
41
|
def render?
|
34
42
|
rows.any? || header.present? || body.present? || footer.present?
|
35
43
|
end
|
36
44
|
|
37
|
-
|
45
|
+
def self.status
|
46
|
+
Primer::Component::STATUSES[:beta]
|
47
|
+
end
|
48
|
+
|
49
|
+
# :nodoc:
|
38
50
|
class Header < Primer::Slot
|
39
51
|
attr_reader :system_arguments
|
40
52
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -48,7 +60,7 @@ module Primer
|
|
48
60
|
end
|
49
61
|
end
|
50
62
|
|
51
|
-
# :nodoc
|
63
|
+
# :nodoc:
|
52
64
|
class Body < Primer::Slot
|
53
65
|
attr_reader :system_arguments
|
54
66
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -62,7 +74,7 @@ module Primer
|
|
62
74
|
end
|
63
75
|
end
|
64
76
|
|
65
|
-
# :nodoc
|
77
|
+
# :nodoc:
|
66
78
|
class Footer < Primer::Slot
|
67
79
|
attr_reader :system_arguments
|
68
80
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -76,7 +88,7 @@ module Primer
|
|
76
88
|
end
|
77
89
|
end
|
78
90
|
|
79
|
-
# :nodoc
|
91
|
+
# :nodoc:
|
80
92
|
class Row < Primer::Slot
|
81
93
|
attr_reader :system_arguments
|
82
94
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -3,10 +3,10 @@
|
|
3
3
|
module Primer
|
4
4
|
# A basic wrapper component for most layout related needs.
|
5
5
|
class BoxComponent < Primer::Component
|
6
|
-
# @example
|
6
|
+
# @example auto|Default
|
7
7
|
# <%= render(Primer::BoxComponent.new) { "Your content here" } %>
|
8
8
|
#
|
9
|
-
# @example
|
9
|
+
# @example auto|Color and padding
|
10
10
|
# <%= render(Primer::BoxComponent.new(bg: :gray, p: 3)) { "Hello world" } %>
|
11
11
|
#
|
12
12
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -7,7 +7,7 @@ module Primer
|
|
7
7
|
|
8
8
|
with_slot :item, collection: true, class_name: "BreadcrumbItem"
|
9
9
|
|
10
|
-
# @example
|
10
|
+
# @example auto|Basic
|
11
11
|
# <%= render(Primer::BreadcrumbComponent.new) do |component| %>
|
12
12
|
# <% component.slot(:item, href: "/") do %>Home<% end %>
|
13
13
|
# <% component.slot(:item, href: "/about") do %>About<% end %>
|
@@ -26,13 +26,13 @@ module Primer
|
|
26
26
|
DEFAULT_TYPE = :button
|
27
27
|
TYPE_OPTIONS = [DEFAULT_TYPE, :reset, :submit].freeze
|
28
28
|
|
29
|
-
# @example
|
29
|
+
# @example auto|Button types
|
30
30
|
# <%= render(Primer::ButtonComponent.new) { "Default" } %>
|
31
31
|
# <%= render(Primer::ButtonComponent.new(button_type: :primary)) { "Primary" } %>
|
32
32
|
# <%= render(Primer::ButtonComponent.new(button_type: :danger)) { "Danger" } %>
|
33
33
|
# <%= render(Primer::ButtonComponent.new(button_type: :outline)) { "Outline" } %>
|
34
34
|
#
|
35
|
-
# @example
|
35
|
+
# @example auto|Variants
|
36
36
|
# <%= render(Primer::ButtonComponent.new(variant: :small)) { "Small" } %>
|
37
37
|
# <%= render(Primer::ButtonComponent.new(variant: :medium)) { "Medium" } %>
|
38
38
|
# <%= render(Primer::ButtonComponent.new(variant: :large)) { "Large" } %>
|
@@ -5,9 +5,12 @@ module Primer
|
|
5
5
|
class ButtonGroupComponent < Primer::Component
|
6
6
|
include ViewComponent::SlotableV2
|
7
7
|
|
8
|
+
# Required list of buttons to be rendered.
|
9
|
+
#
|
10
|
+
# @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::ButtonComponent) %>.
|
8
11
|
renders_many :buttons, ->(**kwargs) { Primer::ButtonComponent.new(group_item: true, **kwargs) }
|
9
12
|
|
10
|
-
# @example
|
13
|
+
# @example auto|Default
|
11
14
|
# <%= render(Primer::ButtonGroupComponent.new) do |component|
|
12
15
|
# component.button { "Default" }
|
13
16
|
# component.button(button_type: :primary) { "Primary" }
|
@@ -25,7 +25,7 @@ module Primer
|
|
25
25
|
DEFAULT_TYPE = :button
|
26
26
|
TYPE_OPTIONS = [DEFAULT_TYPE, :submit].freeze
|
27
27
|
|
28
|
-
# @example
|
28
|
+
# @example auto|Button types
|
29
29
|
# <%= render(Primer::ButtonMarketingComponent.new(mr: 2)) { "Default" } %>
|
30
30
|
# <%= render(Primer::ButtonMarketingComponent.new(button_type: :primary, mr: 2)) { "Primary" } %>
|
31
31
|
# <%= render(Primer::ButtonMarketingComponent.new(button_type: :outline)) { "Outline" } %>
|
@@ -33,7 +33,7 @@ module Primer
|
|
33
33
|
# <%= render(Primer::ButtonMarketingComponent.new(button_type: :transparent)) { "Transparent" } %>
|
34
34
|
# </div>
|
35
35
|
#
|
36
|
-
# @example
|
36
|
+
# @example auto|Sizes
|
37
37
|
# <%= render(Primer::ButtonMarketingComponent.new(mr: 2)) { "Default" } %>
|
38
38
|
# <%= render(Primer::ButtonMarketingComponent.new(variant: :large)) { "Large" } %>
|
39
39
|
#
|