primer_view_components 0.0.11 → 0.0.16
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 +39 -1
- data/README.md +3 -1
- data/app/components/primer/avatar_component.rb +11 -11
- data/app/components/primer/base_component.rb +101 -9
- data/app/components/primer/blankslate_component.html.erb +5 -5
- data/app/components/primer/blankslate_component.rb +31 -6
- data/app/components/primer/border_box_component.html.erb +5 -5
- data/app/components/primer/border_box_component.rb +34 -34
- data/app/components/primer/box_component.rb +5 -5
- data/app/components/primer/breadcrumb_component.html.erb +2 -2
- data/app/components/primer/breadcrumb_component.rb +12 -12
- data/app/components/primer/button_component.rb +9 -9
- data/app/components/primer/counter_component.rb +16 -15
- data/app/components/primer/details_component.html.erb +1 -1
- data/app/components/primer/details_component.rb +15 -15
- data/app/components/primer/dropdown_menu_component.html.erb +1 -1
- data/app/components/primer/dropdown_menu_component.rb +6 -6
- data/app/components/primer/flash_component.html.erb +2 -2
- data/app/components/primer/flash_component.rb +13 -13
- data/app/components/primer/flex_component.rb +5 -5
- data/app/components/primer/flex_item_component.rb +5 -5
- data/app/components/primer/heading_component.rb +4 -4
- data/app/components/primer/label_component.rb +22 -16
- data/app/components/primer/layout_component.html.erb +1 -1
- data/app/components/primer/layout_component.rb +6 -6
- data/app/components/primer/link_component.rb +8 -8
- data/app/components/primer/octicon_component.rb +10 -10
- data/app/components/primer/popover_component.html.erb +1 -1
- data/app/components/primer/popover_component.rb +26 -26
- data/app/components/primer/progress_bar_component.html.erb +2 -2
- data/app/components/primer/progress_bar_component.rb +14 -14
- data/app/components/primer/spinner_component.html.erb +1 -1
- data/app/components/primer/spinner_component.rb +12 -11
- data/app/components/primer/state_component.rb +8 -8
- data/app/components/primer/subhead_component.html.erb +4 -4
- data/app/components/primer/subhead_component.rb +26 -26
- data/app/components/primer/text_component.rb +5 -5
- data/app/components/primer/timeline_item_component.html.erb +4 -4
- data/app/components/primer/timeline_item_component.rb +28 -28
- data/app/components/primer/underline_nav_component.html.erb +1 -1
- data/app/components/primer/underline_nav_component.rb +5 -5
- data/lib/primer/classify.rb +7 -6
- data/lib/primer/view_components/version.rb +1 -1
- metadata +6 -6
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= render(Primer::FlexComponent.new(**@
|
1
|
+
<%= render(Primer::FlexComponent.new(**@system_arguments)) do %>
|
2
2
|
<% if @side == :left %>
|
3
3
|
<%= render Primer::BaseComponent.new(tag: :div, classes: "flex-shrink-0", col: (@responsive ? [12, nil, @sidebar_col] : @sidebar_col), mb: (@responsive ? [4, nil, 0] : nil)) do %>
|
4
4
|
<%= sidebar %>
|
@@ -27,16 +27,16 @@ module Primer
|
|
27
27
|
# @param responsive [Boolean] Whether to collapse layout to a single column at smaller widths.
|
28
28
|
# @param side [Symbol] Which side to display the sidebar on. <%= one_of(Primer::LayoutComponent::ALLOWED_SIDES) %>
|
29
29
|
# @param sidebar_col [Integer] Sidebar column width.
|
30
|
-
# @param
|
31
|
-
def initialize(responsive: false, side: DEFAULT_SIDE, sidebar_col: DEFAULT_SIDEBAR_COL, **
|
32
|
-
@
|
30
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
31
|
+
def initialize(responsive: false, side: DEFAULT_SIDE, sidebar_col: DEFAULT_SIDEBAR_COL, **system_arguments)
|
32
|
+
@system_arguments = system_arguments
|
33
33
|
@side = fetch_or_fallback(ALLOWED_SIDES, side, DEFAULT_SIDE)
|
34
34
|
@responsive = responsive
|
35
|
-
@
|
35
|
+
@system_arguments[:classes] = class_names(
|
36
36
|
"gutter-condensed gutter-lg",
|
37
|
-
@
|
37
|
+
@system_arguments[:classes]
|
38
38
|
)
|
39
|
-
@
|
39
|
+
@system_arguments[:direction] = responsive ? [:column, nil, :row] : nil
|
40
40
|
|
41
41
|
@sidebar_col = fetch_or_fallback(ALLOWED_SIDEBAR_COLS, sidebar_col, DEFAULT_SIDEBAR_COL)
|
42
42
|
@main_col = MAX_COL - @sidebar_col
|
@@ -11,19 +11,19 @@ module Primer
|
|
11
11
|
#
|
12
12
|
# @param href [String] URL to be used for the Link
|
13
13
|
# @param muted [Boolean] Uses light gray for Link color, and blue on hover
|
14
|
-
# @param
|
15
|
-
def initialize(href:, muted: false, **
|
16
|
-
@
|
17
|
-
@
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@
|
14
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
15
|
+
def initialize(href:, muted: false, **system_arguments)
|
16
|
+
@system_arguments = system_arguments
|
17
|
+
@system_arguments[:tag] = :a
|
18
|
+
@system_arguments[:href] = href
|
19
|
+
@system_arguments[:classes] = class_names(
|
20
|
+
@system_arguments[:classes],
|
21
21
|
"muted-link" => fetch_or_fallback([true, false], muted, false)
|
22
22
|
)
|
23
23
|
end
|
24
24
|
|
25
25
|
def call
|
26
|
-
render(Primer::BaseComponent.new(**@
|
26
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Primer
|
4
|
-
# Renders an [Octicon](https://primer.style/octicons/) with <%=
|
4
|
+
# Renders an [Octicon](https://primer.style/octicons/) with <%= link_to_system_arguments_docs %>.
|
5
5
|
class OcticonComponent < Primer::Component
|
6
6
|
include Primer::ClassNameHelper
|
7
7
|
include OcticonsHelper
|
@@ -24,22 +24,22 @@ module Primer
|
|
24
24
|
# <%= render(Primer::OcticonComponent.new(icon: "x", size: :large)) %>
|
25
25
|
#
|
26
26
|
# @param icon [String] Name of [Octicon](https://primer.style/octicons/) to use.
|
27
|
-
# @param size [Symbol] <%= one_of(Primer::OcticonComponent::
|
28
|
-
# @param
|
29
|
-
def initialize(icon:, size: SIZE_DEFAULT, **
|
30
|
-
@icon, @
|
27
|
+
# @param size [Symbol] <%= one_of(Primer::OcticonComponent::SIZE_MAPPINGS) %>
|
28
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
29
|
+
def initialize(icon:, size: SIZE_DEFAULT, **system_arguments)
|
30
|
+
@icon, @system_arguments = icon, system_arguments
|
31
31
|
|
32
|
-
@
|
33
|
-
@
|
32
|
+
@system_arguments[:class] = Primer::Classify.call(**@system_arguments)[:class]
|
33
|
+
@system_arguments[:height] ||= SIZE_MAPPINGS[size]
|
34
34
|
|
35
35
|
# Filter out classify options to prevent them from becoming invalid html attributes.
|
36
36
|
# Note height and width are both classify options and valid html attributes.
|
37
|
-
octicon_helper_options = @
|
38
|
-
@
|
37
|
+
octicon_helper_options = @system_arguments.slice(:height, :width)
|
38
|
+
@system_arguments = @system_arguments.except(*Primer::Classify::VALID_KEYS, :classes).merge(octicon_helper_options)
|
39
39
|
end
|
40
40
|
|
41
41
|
def call
|
42
|
-
octicon(@icon, **@
|
42
|
+
octicon(@icon, **@system_arguments)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -40,17 +40,17 @@ module Primer
|
|
40
40
|
# <% end %>
|
41
41
|
# <% end %>
|
42
42
|
#
|
43
|
-
# @param
|
44
|
-
def initialize(**
|
45
|
-
@
|
46
|
-
@
|
47
|
-
@
|
48
|
-
|
43
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
44
|
+
def initialize(**system_arguments)
|
45
|
+
@system_arguments = system_arguments
|
46
|
+
@system_arguments[:tag] ||= :div
|
47
|
+
@system_arguments[:classes] = class_names(
|
48
|
+
system_arguments[:classes],
|
49
49
|
"Popover"
|
50
50
|
)
|
51
|
-
@
|
52
|
-
@
|
53
|
-
@
|
51
|
+
@system_arguments[:position] ||= :relative
|
52
|
+
@system_arguments[:right] = false unless system_arguments.key?(:right)
|
53
|
+
@system_arguments[:left] = false unless system_arguments.key?(:left)
|
54
54
|
end
|
55
55
|
|
56
56
|
def render?
|
@@ -58,15 +58,15 @@ module Primer
|
|
58
58
|
end
|
59
59
|
|
60
60
|
class Heading < ViewComponent::Slot
|
61
|
-
# @param
|
62
|
-
def initialize(**
|
63
|
-
@
|
64
|
-
@
|
65
|
-
@
|
61
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
62
|
+
def initialize(**system_arguments)
|
63
|
+
@system_arguments = system_arguments
|
64
|
+
@system_arguments[:mb] ||= 2
|
65
|
+
@system_arguments[:tag] ||= :h4
|
66
66
|
end
|
67
67
|
|
68
68
|
def component
|
69
|
-
Primer::HeadingComponent.new(**@
|
69
|
+
Primer::HeadingComponent.new(**@system_arguments)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -89,24 +89,24 @@ module Primer
|
|
89
89
|
|
90
90
|
# @param caret [Symbol] <%= one_of(Primer::PopoverComponent::Body::CARET_MAPPINGS.keys) %>
|
91
91
|
# @param large [Boolean] Whether to use the large version of the component.
|
92
|
-
# @param
|
93
|
-
def initialize(caret: CARET_DEFAULT, large: false, **
|
94
|
-
@
|
95
|
-
@
|
96
|
-
|
92
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
93
|
+
def initialize(caret: CARET_DEFAULT, large: false, **system_arguments)
|
94
|
+
@system_arguments = system_arguments
|
95
|
+
@system_arguments[:classes] = class_names(
|
96
|
+
system_arguments[:classes],
|
97
97
|
"Popover-message Box",
|
98
98
|
CARET_MAPPINGS[fetch_or_fallback(CARET_MAPPINGS.keys, caret, CARET_DEFAULT)],
|
99
99
|
"Popover-message--large" => large
|
100
100
|
)
|
101
|
-
@
|
102
|
-
@
|
103
|
-
@
|
104
|
-
@
|
105
|
-
@
|
101
|
+
@system_arguments[:p] ||= 4
|
102
|
+
@system_arguments[:mt] ||= 2
|
103
|
+
@system_arguments[:mx] ||= :auto
|
104
|
+
@system_arguments[:text_align] ||= :left
|
105
|
+
@system_arguments[:box_shadow] ||= :large
|
106
106
|
end
|
107
107
|
|
108
108
|
def component
|
109
|
-
Primer::BoxComponent.new(**@
|
109
|
+
Primer::BoxComponent.new(**@system_arguments)
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<%= render Primer::BaseComponent.new(**@
|
1
|
+
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
|
2
2
|
<% items.each do |item| %>
|
3
|
-
<%= render Primer::BaseComponent.new(**item.
|
3
|
+
<%= render Primer::BaseComponent.new(**item.system_arguments) %>
|
4
4
|
<% end %>
|
5
5
|
<% end %>
|
@@ -39,15 +39,15 @@ module Primer
|
|
39
39
|
# <% end %>
|
40
40
|
#
|
41
41
|
# @param size [Symbol] <%= one_of(Primer::ProgressBarComponent::SIZE_OPTIONS) %> Increases height.
|
42
|
-
# @param
|
43
|
-
def initialize(size: SIZE_DEFAULT, **
|
44
|
-
@
|
45
|
-
@
|
46
|
-
@
|
42
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
43
|
+
def initialize(size: SIZE_DEFAULT, **system_arguments)
|
44
|
+
@system_arguments = system_arguments
|
45
|
+
@system_arguments[:classes] = class_names(
|
46
|
+
@system_arguments[:classes],
|
47
47
|
"Progress",
|
48
48
|
SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)]
|
49
49
|
)
|
50
|
-
@
|
50
|
+
@system_arguments[:tag] = :span
|
51
51
|
|
52
52
|
end
|
53
53
|
|
@@ -57,19 +57,19 @@ module Primer
|
|
57
57
|
|
58
58
|
class Item < ViewComponent::Slot
|
59
59
|
include ClassNameHelper
|
60
|
-
attr_reader :
|
60
|
+
attr_reader :system_arguments
|
61
61
|
|
62
62
|
# @param percentage [Integer] Percentage completion of item.
|
63
63
|
# @param bg [Symbol] Color of item.
|
64
|
-
# @param
|
65
|
-
def initialize(percentage: 0, bg: :green, **
|
64
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
65
|
+
def initialize(percentage: 0, bg: :green, **system_arguments)
|
66
66
|
@percentage = percentage
|
67
|
-
@
|
67
|
+
@system_arguments = system_arguments
|
68
68
|
|
69
|
-
@
|
70
|
-
@
|
71
|
-
@
|
72
|
-
@
|
69
|
+
@system_arguments[:tag] = :span
|
70
|
+
@system_arguments[:bg] = bg
|
71
|
+
@system_arguments[:style] = "width: #{@percentage}%;"
|
72
|
+
@system_arguments[:classes] = class_names("Progress-item", @system_arguments[:classes])
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= render Primer::BaseComponent.new(**@
|
1
|
+
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
|
2
2
|
<circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" />
|
3
3
|
<path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke">
|
4
4
|
<animateTransform attributeName="transform" type="rotate" from="0 8 8" to="360 8 8" dur="1s" repeatCount="indefinite" />
|
@@ -11,6 +11,9 @@ module Primer
|
|
11
11
|
:large => 64,
|
12
12
|
}.freeze
|
13
13
|
SIZE_OPTIONS = SIZE_MAPPINGS.keys
|
14
|
+
# Setting `box-sizing: content-box` allows consumers to add padding
|
15
|
+
# to the spinner without shrinking the icon
|
16
|
+
DEFAULT_STYLE = "box-sizing: content-box; color: var(--color-icon-primary);"
|
14
17
|
|
15
18
|
#
|
16
19
|
# @example 48|Default
|
@@ -22,17 +25,15 @@ module Primer
|
|
22
25
|
# @example 80|Large
|
23
26
|
# <%= render(Primer::SpinnerComponent.new(size: :large)) %>
|
24
27
|
#
|
25
|
-
# @param size [Symbol] <%= one_of(Primer::SpinnerComponent::
|
26
|
-
def initialize(size: DEFAULT_SIZE, **
|
27
|
-
@
|
28
|
-
@
|
29
|
-
@
|
30
|
-
@
|
31
|
-
@
|
32
|
-
@
|
33
|
-
|
34
|
-
# to the spinner without shrinking the icon
|
35
|
-
@kwargs[:style] = "box-sizing: content-box; color: var(--color-icon-primary);"
|
28
|
+
# @param size [Symbol] <%= one_of(Primer::SpinnerComponent::SIZE_MAPPINGS) %>
|
29
|
+
def initialize(size: DEFAULT_SIZE, style: DEFAULT_STYLE, **system_arguments)
|
30
|
+
@system_arguments = system_arguments
|
31
|
+
@system_arguments[:tag] = :svg
|
32
|
+
@system_arguments[:width] = SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)]
|
33
|
+
@system_arguments[:height] = SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)]
|
34
|
+
@system_arguments[:viewBox] = "0 0 16 16"
|
35
|
+
@system_arguments[:fill] = :none
|
36
|
+
@system_arguments[:style] = DEFAULT_STYLE unless style.nil?
|
36
37
|
end
|
37
38
|
end
|
38
39
|
end
|
@@ -39,19 +39,19 @@ module Primer
|
|
39
39
|
# @param color [Symbol] Background color. <%= one_of(Primer::StateComponent::COLOR_OPTIONS) %>
|
40
40
|
# @param tag [Symbol] HTML tag for element. <%= one_of(Primer::StateComponent::TAG_OPTIONS) %>
|
41
41
|
# @param size [Symbol] <%= one_of(Primer::StateComponent::SIZE_OPTIONS) %>
|
42
|
-
# @param
|
42
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
43
43
|
def initialize(
|
44
44
|
title:,
|
45
45
|
color: COLOR_DEFAULT,
|
46
46
|
tag: TAG_DEFAULT,
|
47
47
|
size: SIZE_DEFAULT,
|
48
|
-
**
|
48
|
+
**system_arguments
|
49
49
|
)
|
50
|
-
@
|
51
|
-
@
|
52
|
-
@
|
53
|
-
@
|
54
|
-
@
|
50
|
+
@system_arguments = system_arguments
|
51
|
+
@system_arguments[:title] = title
|
52
|
+
@system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, TAG_DEFAULT)
|
53
|
+
@system_arguments[:classes] = class_names(
|
54
|
+
@system_arguments[:classes],
|
55
55
|
"State",
|
56
56
|
COLOR_MAPPINGS[fetch_or_fallback(COLOR_OPTIONS, color, COLOR_DEFAULT)],
|
57
57
|
SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)]
|
@@ -59,7 +59,7 @@ module Primer
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def call
|
62
|
-
render(Primer::BaseComponent.new(**@
|
62
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
<%= render Primer::BaseComponent.new(**@
|
1
|
+
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
|
2
2
|
<% if heading.present? %>
|
3
|
-
<%= render Primer::BaseComponent.new(**heading.
|
3
|
+
<%= render Primer::BaseComponent.new(**heading.system_arguments) do %>
|
4
4
|
<%= heading.content %>
|
5
5
|
<% end %>
|
6
6
|
<% end %>
|
7
7
|
<% if actions.present? %>
|
8
|
-
<%= render Primer::BaseComponent.new(**actions.
|
8
|
+
<%= render Primer::BaseComponent.new(**actions.system_arguments) do %>
|
9
9
|
<%= actions.content %>
|
10
10
|
<% end %>
|
11
11
|
<% end %>
|
12
12
|
<% if description.present? %>
|
13
|
-
<%= render Primer::BaseComponent.new(**description.
|
13
|
+
<%= render Primer::BaseComponent.new(**description.system_arguments) do %>
|
14
14
|
<%= description.content %>
|
15
15
|
<% end %>
|
16
16
|
<% end %>
|
@@ -48,19 +48,19 @@ module Primer
|
|
48
48
|
#
|
49
49
|
# @param spacious [Boolean] Whether to add spacing to the Subhead.
|
50
50
|
# @param hide_border [Boolean] Whether to hide the border under the heading.
|
51
|
-
# @param
|
52
|
-
def initialize(spacious: false, hide_border: false, **
|
53
|
-
@
|
51
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
52
|
+
def initialize(spacious: false, hide_border: false, **system_arguments)
|
53
|
+
@system_arguments = system_arguments
|
54
54
|
|
55
|
-
@
|
56
|
-
@
|
55
|
+
@system_arguments[:tag] = :div
|
56
|
+
@system_arguments[:classes] =
|
57
57
|
class_names(
|
58
|
-
@
|
58
|
+
@system_arguments[:classes],
|
59
59
|
"Subhead hx_Subhead--responsive",
|
60
60
|
"Subhead--spacious": spacious,
|
61
61
|
"border-bottom-0": hide_border
|
62
62
|
)
|
63
|
-
@
|
63
|
+
@system_arguments[:mb] ||= hide_border ? 0 : nil
|
64
64
|
end
|
65
65
|
|
66
66
|
def render?
|
@@ -70,15 +70,15 @@ module Primer
|
|
70
70
|
class Heading < ViewComponent::Slot
|
71
71
|
include ClassNameHelper
|
72
72
|
|
73
|
-
attr_reader :
|
73
|
+
attr_reader :system_arguments
|
74
74
|
|
75
75
|
# @param danger [Boolean] Whether to style the heading as dangerous.
|
76
|
-
# @param
|
77
|
-
def initialize(danger: false, **
|
78
|
-
@
|
79
|
-
@
|
80
|
-
@
|
81
|
-
@
|
76
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
77
|
+
def initialize(danger: false, **system_arguments)
|
78
|
+
@system_arguments = system_arguments
|
79
|
+
@system_arguments[:tag] ||= :div
|
80
|
+
@system_arguments[:classes] = class_names(
|
81
|
+
@system_arguments[:classes],
|
82
82
|
"Subhead-heading",
|
83
83
|
"Subhead-heading--danger": danger
|
84
84
|
)
|
@@ -88,26 +88,26 @@ module Primer
|
|
88
88
|
class Actions < ViewComponent::Slot
|
89
89
|
include ClassNameHelper
|
90
90
|
|
91
|
-
attr_reader :
|
91
|
+
attr_reader :system_arguments
|
92
92
|
|
93
|
-
# @param
|
94
|
-
def initialize(**
|
95
|
-
@
|
96
|
-
@
|
97
|
-
@
|
93
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
94
|
+
def initialize(**system_arguments)
|
95
|
+
@system_arguments = system_arguments
|
96
|
+
@system_arguments[:tag] = :div
|
97
|
+
@system_arguments[:classes] = class_names(@system_arguments[:classes], "Subhead-actions")
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
101
|
class Description < ViewComponent::Slot
|
102
102
|
include ClassNameHelper
|
103
103
|
|
104
|
-
attr_reader :
|
104
|
+
attr_reader :system_arguments
|
105
105
|
|
106
|
-
# @param
|
107
|
-
def initialize(**
|
108
|
-
@
|
109
|
-
@
|
110
|
-
@
|
106
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
107
|
+
def initialize(**system_arguments)
|
108
|
+
@system_arguments = system_arguments
|
109
|
+
@system_arguments[:tag] = :div
|
110
|
+
@system_arguments[:classes] = class_names(@system_arguments[:classes], "Subhead-description")
|
111
111
|
end
|
112
112
|
end
|
113
113
|
end
|
@@ -7,14 +7,14 @@ module Primer
|
|
7
7
|
# <%= render(Primer::TextComponent.new(tag: :p, font_weight: :bold)) { "Bold Text" } %>
|
8
8
|
# <%= render(Primer::TextComponent.new(tag: :p, color: :red_5)) { "Red Text" } %>
|
9
9
|
#
|
10
|
-
# @param
|
11
|
-
def initialize(**
|
12
|
-
@
|
13
|
-
@
|
10
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
11
|
+
def initialize(**system_arguments)
|
12
|
+
@system_arguments = system_arguments
|
13
|
+
@system_arguments[:tag] ||= :span
|
14
14
|
end
|
15
15
|
|
16
16
|
def call
|
17
|
-
render(Primer::BaseComponent.new(**@
|
17
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|