primer_view_components 0.0.16 → 0.0.21
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 +82 -0
- data/app/components/primer/avatar_component.rb +27 -9
- 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 +8 -4
- data/app/components/primer/blankslate_component.html.erb +1 -1
- data/app/components/primer/blankslate_component.rb +18 -25
- data/app/components/primer/border_box_component.rb +29 -13
- data/app/components/primer/box_component.rb +10 -0
- data/app/components/primer/breadcrumb_component.rb +3 -2
- data/app/components/primer/button_component.rb +3 -3
- data/app/components/primer/button_group_component.html.erb +5 -0
- data/app/components/primer/button_group_component.rb +37 -0
- data/app/components/primer/button_marketing_component.rb +73 -0
- data/app/components/primer/component.rb +13 -0
- data/app/components/primer/counter_component.rb +16 -9
- data/app/components/primer/details_component.rb +10 -6
- 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 +35 -3
- data/app/components/primer/flash_component.html.erb +2 -5
- data/app/components/primer/flash_component.rb +18 -19
- data/app/components/primer/flex_component.rb +47 -9
- data/app/components/primer/flex_item_component.rb +16 -1
- data/app/components/primer/heading_component.rb +7 -0
- data/app/components/primer/label_component.rb +6 -6
- data/app/components/primer/layout_component.rb +2 -2
- data/app/components/primer/link_component.rb +7 -3
- 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 +11 -6
- data/app/components/primer/popover_component.rb +6 -4
- data/app/components/primer/progress_bar_component.rb +9 -9
- data/app/components/primer/slot.rb +1 -0
- data/app/components/primer/spinner_component.rb +10 -7
- data/app/components/primer/state_component.rb +6 -6
- data/app/components/primer/subhead_component.rb +6 -3
- data/app/components/primer/text_component.rb +1 -1
- data/app/components/primer/timeline_item_component.html.erb +4 -16
- data/app/components/primer/timeline_item_component.rb +41 -49
- data/app/components/primer/tooltip_component.rb +88 -0
- data/app/components/primer/truncate_component.rb +41 -0
- data/app/components/primer/underline_nav_component.rb +26 -1
- data/app/components/primer/view_components.rb +9 -0
- data/lib/primer/class_name_helper.rb +1 -0
- data/lib/primer/classify.rb +139 -107
- data/lib/primer/classify/cache.rb +125 -0
- data/lib/primer/fetch_or_fallback_helper.rb +9 -0
- data/lib/primer/join_style_arguments_helper.rb +14 -0
- data/lib/primer/view_components.rb +32 -0
- data/lib/primer/view_components/engine.rb +1 -0
- 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 +80 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62c2e7e2e043daf8288aa72a91d674af96180cc0430c8d59c5fdbf5764e19b59
|
4
|
+
data.tar.gz: 75b205867ce0f2835ee32d9a859032d02eef6dbb98b8ff5c9d485001893fce5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6ad3831ccbb77616d668036954108e3642ffe747ee2837714761ebc54ca353b654813cad3396bb31e4a94f03f6e84f5ae52c75cf07387fffd24758d73967b70
|
7
|
+
data.tar.gz: 79d4aca35c8556fcbbcbab8fb6cf5d4e5440f920508af5ed880bb200a03820869a576ebafd3200ff756a3b7a580855c8b1c77ba71a65f085367fc80ac063e49f
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,88 @@
|
|
2
2
|
|
3
3
|
## main
|
4
4
|
|
5
|
+
## 0.0.21
|
6
|
+
|
7
|
+
* **Breaking change**: Upgrade `FlashComponent` to use Slots V2.
|
8
|
+
|
9
|
+
*Joel Hawksley, Simon Taranto*
|
10
|
+
|
11
|
+
* **Breaking change**: Upgrade `BlankslateComponent` to use Slots V2.
|
12
|
+
|
13
|
+
*Manuel Puyol*
|
14
|
+
|
15
|
+
* **Breaking change**: Upgrade `TimelineItemComponent` to use Slots V2.
|
16
|
+
|
17
|
+
*Manuel Puyol*
|
18
|
+
|
19
|
+
## 0.0.20
|
20
|
+
|
21
|
+
* Fix bug when empty string was passed to Classify.
|
22
|
+
|
23
|
+
*Manuel Puyol*
|
24
|
+
|
25
|
+
## 0.0.19
|
26
|
+
|
27
|
+
* Add support for functional colors to `color` system argument.
|
28
|
+
|
29
|
+
*Jake Shorty*
|
30
|
+
|
31
|
+
* Add `AvatarStack`, `Dropdown`, `Markdown` and `Menu` components.
|
32
|
+
|
33
|
+
*Manuel Puyol*
|
34
|
+
|
35
|
+
* Deprecate `DropdownMenuComponent`.
|
36
|
+
|
37
|
+
*Manuel Puyol*
|
38
|
+
|
39
|
+
* Fix `Avatar` bug when used with links.
|
40
|
+
|
41
|
+
*Manuel Puyol*
|
42
|
+
|
43
|
+
* Add cache for common Primer values.
|
44
|
+
|
45
|
+
*Blake Williams*
|
46
|
+
|
47
|
+
* Add support for `octicons_helper` v12.
|
48
|
+
|
49
|
+
*Cole Bemis*
|
50
|
+
|
51
|
+
* Add support for `border: true` to apply the `border` class.
|
52
|
+
|
53
|
+
*Simon Taranto*
|
54
|
+
|
55
|
+
* Promote `Avatar`, `Link`, and `Counter` components to beta.
|
56
|
+
|
57
|
+
*Simon Taranto*
|
58
|
+
|
59
|
+
* **Breaking change**: Drop support for Ruby 2.4.
|
60
|
+
|
61
|
+
*Simon Taranto*
|
62
|
+
|
63
|
+
## 0.0.18
|
64
|
+
|
65
|
+
* Add `border_radius` system argument.
|
66
|
+
|
67
|
+
*Ash Guillaume*
|
68
|
+
|
69
|
+
* Add `animation` system argument.
|
70
|
+
|
71
|
+
*Manuel Puyol*
|
72
|
+
|
73
|
+
* Add `Truncate`, `ButtonGroup` and `ButtonMarketing` components.
|
74
|
+
|
75
|
+
*Manuel Puyol*
|
76
|
+
|
77
|
+
* Add `Tooltip` component.
|
78
|
+
|
79
|
+
*Simon Taranto*
|
80
|
+
|
81
|
+
## 0.0.17
|
82
|
+
|
83
|
+
* Ensure all components support inline styles.
|
84
|
+
|
85
|
+
*Joel Hawksley*
|
86
|
+
|
5
87
|
## 0.0.16
|
6
88
|
|
7
89
|
* Adding a `spinner` slot to the `BlankslateComponent` that uses the `SpinnerComponent` added in `0.0.10`.
|
@@ -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
|
#
|
14
|
-
# @
|
15
|
-
#
|
16
|
-
#
|
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
|
+
#
|
19
|
+
# @param src [String] The source url of the avatar image.
|
20
|
+
# @param alt [String] Passed through to alt on img tag.
|
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
|
@@ -34,6 +34,7 @@ module Primer
|
|
34
34
|
# | `data` | `Hash` | Data attributes: `data: { foo: :bar }` renders `data-foo='bar'`. |
|
35
35
|
# | `aria` | `Hash` | Aria attributes: `aria: { label: "foo" }` renders `aria-label='foo'`. |
|
36
36
|
# | `title` | `String` | The `title` attribute. |
|
37
|
+
# | `style` | `String` | Inline styles. |
|
37
38
|
# | `hidden` | `Boolean` | Whether to assign the `hidden` attribute. |
|
38
39
|
class BaseComponent < Primer::Component
|
39
40
|
TEST_SELECTOR_TAG = :test_selector
|
@@ -61,7 +62,7 @@ module Primer
|
|
61
62
|
# @param bottom [Boolean] If `false`, sets `bottom: 0`.
|
62
63
|
# @param left [Boolean] If `false`, sets `left: 0`.
|
63
64
|
#
|
64
|
-
# @param display [Symbol] <%= one_of([:block, :
|
65
|
+
# @param display [Symbol] <%= one_of([:none, :block, :flex, :inline, :inline_block, :table, :table_cell]) %>
|
65
66
|
#
|
66
67
|
# @param v [Symbol] Visibility. <%= one_of([:hidden, :visible]) %>
|
67
68
|
#
|
@@ -75,16 +76,17 @@ module Primer
|
|
75
76
|
#
|
76
77
|
# @param underline [Boolean] Whether text should be underlined.
|
77
78
|
#
|
78
|
-
# @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]) %>
|
79
80
|
# @param bg [String, Symbol] Background color. Accepts either a hex value as a String or a color name as a Symbol.
|
80
81
|
#
|
81
82
|
# @param box_shadow [Boolean, Symbol] Box shadow. <%= one_of([true, :medium, :large, :extra_large, :none]) %>
|
82
|
-
# @param border [Symbol] <%= one_of([:left, :top, :bottom, :right, :y, :x]) %>
|
83
|
+
# @param border [Symbol] <%= one_of([:left, :top, :bottom, :right, :y, :x, true]) %>
|
83
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.
|
84
85
|
# @param border_top [Integer] Set to `0` to remove the top border.
|
85
86
|
# @param border_bottom [Integer] Set to `0` to remove the bottom border.
|
86
87
|
# @param border_left [Integer] Set to `0` to remove the left border.
|
87
88
|
# @param border_right [Integer] Set to `0` to remove the right border.
|
89
|
+
# @param border_radius [Integer] <%= one_of([0, 1, 2, 3]) %>
|
88
90
|
#
|
89
91
|
# @param font_size [String, Integer] <%= one_of(["00", 0, 1, 2, 3, 4, 5, 6]) %>
|
90
92
|
# @param text_align [Symbol] Text alignment. <%= one_of([:left, :right, :center]) %>
|
@@ -101,6 +103,8 @@ module Primer
|
|
101
103
|
#
|
102
104
|
# @param word_break [Symbol] Whether to break words on line breaks. Can only be `:break_all`.
|
103
105
|
#
|
106
|
+
# @param animation [Symbol] <%= one_of([:fade_in, :fade_out, :fade_up, :fade_down, :scale_in, :pulse, :grow_x, :grow]) %>
|
107
|
+
#
|
104
108
|
# @param tag [Symbol] HTML tag name to be passed to `tag.send`.
|
105
109
|
# @param classes [String] CSS class name value to be concatenated with generated Primer CSS classes.
|
106
110
|
def initialize(tag:, classes: nil, **system_arguments)
|
@@ -112,7 +116,7 @@ module Primer
|
|
112
116
|
end
|
113
117
|
|
114
118
|
def call
|
115
|
-
content_tag(@tag, content,
|
119
|
+
content_tag(@tag, content, @content_tag_args.merge(@result))
|
116
120
|
end
|
117
121
|
|
118
122
|
private
|
@@ -3,40 +3,46 @@
|
|
3
3
|
module Primer
|
4
4
|
# Use Primer::BlankslateComponent when there is a lack of content within a page or section. Use as placeholder to tell users why something isn't there.
|
5
5
|
class BlankslateComponent < Primer::Component
|
6
|
-
include ViewComponent::
|
6
|
+
include ViewComponent::SlotableV2
|
7
7
|
|
8
|
-
|
8
|
+
# Optional Spinner.
|
9
|
+
#
|
10
|
+
# @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::SpinnerComponent) %>.
|
11
|
+
renders_one :spinner, lambda { |**system_arguments|
|
12
|
+
system_arguments[:mb] ||= 3
|
13
|
+
Primer::SpinnerComponent.new(**system_arguments)
|
14
|
+
}
|
9
15
|
|
10
16
|
#
|
11
|
-
# @example
|
17
|
+
# @example auto|Basic
|
12
18
|
# <%= render Primer::BlankslateComponent.new(
|
13
19
|
# title: "Title",
|
14
20
|
# description: "Description",
|
15
21
|
# ) %>
|
16
22
|
#
|
17
|
-
# @example
|
23
|
+
# @example auto|Icon|Add an `icon` to give additional context. Refer to the [Octicons](https://primer.style/octicons/) documentation to choose an icon.
|
18
24
|
# <%= render Primer::BlankslateComponent.new(
|
19
25
|
# icon: "octoface",
|
20
26
|
# title: "Title",
|
21
27
|
# description: "Description",
|
22
28
|
# ) %>
|
23
29
|
#
|
24
|
-
# @example
|
30
|
+
# @example auto|Loading|Add a [SpinnerComponent](https://primer.style/view-components/components/spinner) to the blankslate in place of an icon.
|
25
31
|
# <%= render Primer::BlankslateComponent.new(
|
26
32
|
# title: "Title",
|
27
33
|
# description: "Description",
|
28
34
|
# ) do |component| %>
|
29
|
-
# <% component.
|
35
|
+
# <% component.spinner(size: :large) %>
|
30
36
|
# <% end %>
|
31
37
|
#
|
32
|
-
# @example
|
38
|
+
# @example auto|Custom content|Pass custom content as a block in place of `description`.
|
33
39
|
# <%= render Primer::BlankslateComponent.new(
|
34
40
|
# title: "Title",
|
35
41
|
# ) do %>
|
36
42
|
# <em>Your custom content here</em>
|
37
43
|
# <% end %>
|
38
44
|
#
|
39
|
-
# @example
|
45
|
+
# @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
46
|
# <%= render Primer::BlankslateComponent.new(
|
41
47
|
# icon: "book",
|
42
48
|
# title: "Welcome to the mona wiki!",
|
@@ -46,7 +52,7 @@ module Primer
|
|
46
52
|
# button_url: "https://github.com/monalisa/mona/wiki/_new",
|
47
53
|
# ) %>
|
48
54
|
#
|
49
|
-
# @example
|
55
|
+
# @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
56
|
# <%= render Primer::BlankslateComponent.new(
|
51
57
|
# icon: "book",
|
52
58
|
# title: "Welcome to the mona wiki!",
|
@@ -55,7 +61,7 @@ module Primer
|
|
55
61
|
# link_url: "https://docs.github.com/en/github/building-a-strong-community/about-wikis",
|
56
62
|
# ) %>
|
57
63
|
#
|
58
|
-
# @example
|
64
|
+
# @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
65
|
# <%= render Primer::BlankslateComponent.new(
|
60
66
|
# icon: "book",
|
61
67
|
# title: "Welcome to the mona wiki!",
|
@@ -94,7 +100,7 @@ module Primer
|
|
94
100
|
link_text: "",
|
95
101
|
link_url: "",
|
96
102
|
|
97
|
-
#variations
|
103
|
+
# variations
|
98
104
|
narrow: false,
|
99
105
|
large: false,
|
100
106
|
spacious: false,
|
@@ -108,7 +114,7 @@ module Primer
|
|
108
114
|
"blankslate",
|
109
115
|
"blankslate-narrow": narrow,
|
110
116
|
"blankslate-large": large,
|
111
|
-
"blankslate-spacious": spacious
|
117
|
+
"blankslate-spacious": spacious
|
112
118
|
)
|
113
119
|
|
114
120
|
@title_tag = title_tag
|
@@ -124,18 +130,5 @@ module Primer
|
|
124
130
|
@link_text = link_text
|
125
131
|
@link_url = link_url
|
126
132
|
end
|
127
|
-
|
128
|
-
class Spinner < Primer::Slot
|
129
|
-
# @param size [Symbol] <%= one_of(Primer::SpinnerComponent::SIZE_MAPPINGS) %>
|
130
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
131
|
-
def initialize(**system_arguments)
|
132
|
-
@system_arguments = system_arguments
|
133
|
-
@system_arguments[:mb] ||= 3
|
134
|
-
end
|
135
|
-
|
136
|
-
def component
|
137
|
-
Primer::SpinnerComponent.new(**@system_arguments)
|
138
|
-
end
|
139
|
-
end
|
140
133
|
end
|
141
134
|
end
|
@@ -10,30 +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
|
|
45
|
+
def self.status
|
46
|
+
Primer::Component::STATUSES[:beta]
|
47
|
+
end
|
48
|
+
|
49
|
+
# :nodoc:
|
37
50
|
class Header < Primer::Slot
|
38
51
|
attr_reader :system_arguments
|
39
52
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -47,6 +60,7 @@ module Primer
|
|
47
60
|
end
|
48
61
|
end
|
49
62
|
|
63
|
+
# :nodoc:
|
50
64
|
class Body < Primer::Slot
|
51
65
|
attr_reader :system_arguments
|
52
66
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -60,6 +74,7 @@ module Primer
|
|
60
74
|
end
|
61
75
|
end
|
62
76
|
|
77
|
+
# :nodoc:
|
63
78
|
class Footer < Primer::Slot
|
64
79
|
attr_reader :system_arguments
|
65
80
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -73,6 +88,7 @@ module Primer
|
|
73
88
|
end
|
74
89
|
end
|
75
90
|
|
91
|
+
# :nodoc:
|
76
92
|
class Row < Primer::Slot
|
77
93
|
attr_reader :system_arguments
|
78
94
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|