primer_view_components 0.0.17 → 0.0.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +102 -0
  3. data/app/assets/javascripts/primer_view_components.js +2 -0
  4. data/app/assets/javascripts/primer_view_components.js.map +1 -0
  5. data/app/components/primer/avatar_component.rb +27 -9
  6. data/app/components/primer/avatar_stack_component.html.erb +10 -0
  7. data/app/components/primer/avatar_stack_component.rb +81 -0
  8. data/app/components/primer/base_component.rb +8 -5
  9. data/app/components/primer/blankslate_component.html.erb +3 -3
  10. data/app/components/primer/blankslate_component.rb +18 -25
  11. data/app/components/primer/border_box_component.html.erb +4 -18
  12. data/app/components/primer/border_box_component.rb +75 -68
  13. data/app/components/primer/box_component.rb +10 -0
  14. data/app/components/primer/breadcrumb_component.rb +3 -2
  15. data/app/components/primer/button_component.rb +3 -3
  16. data/app/components/primer/button_group_component.html.erb +5 -0
  17. data/app/components/primer/button_group_component.rb +37 -0
  18. data/app/components/primer/button_marketing_component.rb +73 -0
  19. data/app/components/primer/component.rb +16 -0
  20. data/app/components/primer/counter_component.rb +16 -9
  21. data/app/components/primer/details_component.html.erb +2 -6
  22. data/app/components/primer/details_component.rb +28 -37
  23. data/app/components/primer/dropdown/menu_component.html.erb +12 -0
  24. data/app/components/primer/dropdown/menu_component.rb +48 -0
  25. data/app/components/primer/dropdown_component.html.erb +9 -0
  26. data/app/components/primer/dropdown_component.rb +75 -0
  27. data/app/components/primer/dropdown_menu_component.rb +35 -3
  28. data/app/components/primer/flash_component.html.erb +4 -7
  29. data/app/components/primer/flash_component.rb +18 -17
  30. data/app/components/primer/flex_component.rb +47 -9
  31. data/app/components/primer/flex_item_component.rb +16 -1
  32. data/app/components/primer/heading_component.rb +9 -0
  33. data/app/components/primer/label_component.rb +6 -6
  34. data/app/components/primer/layout_component.rb +2 -2
  35. data/app/components/primer/link_component.rb +6 -2
  36. data/app/components/primer/markdown_component.rb +293 -0
  37. data/app/components/primer/menu_component.html.erb +6 -0
  38. data/app/components/primer/menu_component.rb +71 -0
  39. data/app/components/primer/octicon_component.rb +13 -6
  40. data/app/components/primer/popover_component.rb +5 -3
  41. data/app/components/primer/primer.js +1 -0
  42. data/app/components/primer/primer.ts +1 -0
  43. data/app/components/primer/progress_bar_component.rb +6 -6
  44. data/app/components/primer/spinner_component.rb +8 -5
  45. data/app/components/primer/state_component.rb +23 -12
  46. data/app/components/primer/subhead_component.rb +6 -3
  47. data/app/components/primer/tab_container_component.js +1 -0
  48. data/app/components/primer/tab_container_component.rb +41 -0
  49. data/app/components/primer/tab_container_component.ts +1 -0
  50. data/app/components/primer/tab_nav_component.html.erb +17 -0
  51. data/app/components/primer/tab_nav_component.rb +108 -0
  52. data/app/components/primer/text_component.rb +1 -1
  53. data/app/components/primer/timeline_item_component.html.erb +4 -16
  54. data/app/components/primer/timeline_item_component.rb +41 -49
  55. data/app/components/primer/tooltip_component.rb +88 -0
  56. data/app/components/primer/truncate_component.rb +41 -0
  57. data/app/components/primer/underline_nav_component.rb +26 -1
  58. data/{lib → app/lib}/primer/class_name_helper.rb +1 -0
  59. data/app/lib/primer/classify.rb +280 -0
  60. data/app/lib/primer/classify/cache.rb +125 -0
  61. data/{lib → app/lib}/primer/fetch_or_fallback_helper.rb +1 -0
  62. data/{lib → app/lib}/primer/join_style_arguments_helper.rb +1 -0
  63. data/app/lib/primer/view_helper.rb +22 -0
  64. data/app/lib/primer/view_helper/dsl.rb +34 -0
  65. data/lib/primer/view_components.rb +32 -0
  66. data/lib/primer/view_components/engine.rb +11 -2
  67. data/lib/primer/view_components/version.rb +5 -1
  68. data/lib/yard/renders_many_handler.rb +19 -0
  69. data/lib/yard/renders_one_handler.rb +19 -0
  70. data/static/statuses.json +1 -0
  71. metadata +94 -24
  72. data/app/components/primer/view_components.rb +0 -52
  73. data/lib/primer/classify.rb +0 -250
@@ -1,10 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Primer
4
+ # Use FlexItemComponent to specify the ability of a flex item to alter its
5
+ # dimensions to fill available space
4
6
  class FlexItemComponent < Primer::Component
5
7
  FLEX_AUTO_DEFAULT = false
6
- FLEX_AUTO_ALLOWED_VALUES = [FLEX_AUTO_DEFAULT, true]
8
+ FLEX_AUTO_ALLOWED_VALUES = [FLEX_AUTO_DEFAULT, true].freeze
7
9
 
10
+ # @example Default
11
+ # <%= render(Primer::FlexComponent.new) do %>
12
+ # <%= render(Primer::FlexItemComponent.new) do %>
13
+ # Item 1
14
+ # <% end %>
15
+ #
16
+ # <%= render(Primer::FlexItemComponent.new(flex_auto: true)) do %>
17
+ # Item 2
18
+ # <% end %>
19
+ # <% end %>
20
+ #
21
+ # @param flex_auto [Boolean] Fills available space and auto-sizes based on the content. Defaults to <%= Primer::FlexItemComponent::FLEX_AUTO_DEFAULT %>
22
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
8
23
  def initialize(flex_auto: FLEX_AUTO_DEFAULT, **system_arguments)
9
24
  @system_arguments = system_arguments
10
25
  @system_arguments[:classes] =
@@ -1,7 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Primer
4
+ # Use the Heading component to wrap a component that will create a heading element
4
5
  class HeadingComponent < Primer::Component
6
+ view_helper :heading
7
+
8
+ # @example Default
9
+ # <%= render(Primer::HeadingComponent.new) { "H1 Text" } %>
10
+ # <%= render(Primer::HeadingComponent.new(tag: :h2)) { "H2 Text" } %>
11
+ # <%= render(Primer::HeadingComponent.new(tag: :h3)) { "H3 Text" } %>
12
+ #
13
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
5
14
  def initialize(**system_arguments)
6
15
  @system_arguments = system_arguments
7
16
  @system_arguments[:tag] ||= :h1
@@ -9,8 +9,8 @@ module Primer
9
9
  info: "Label--info",
10
10
  success: "Label--success",
11
11
  warning: "Label--warning",
12
- danger: "Label--danger",
13
- }
12
+ danger: "Label--danger"
13
+ }.freeze
14
14
 
15
15
  DEPRECATED_SCHEME_MAPPINGS = {
16
16
  gray: "Label--gray",
@@ -23,7 +23,7 @@ module Primer
23
23
  purple: "Label--purple",
24
24
  pink: "Label--pink",
25
25
  outline: "Label--outline",
26
- green_outline: "Label--outline-green",
26
+ green_outline: "Label--outline-green"
27
27
  }.freeze
28
28
 
29
29
  SCHEME_MAPPINGS = NEW_SCHEME_MAPPINGS.merge(DEPRECATED_SCHEME_MAPPINGS)
@@ -31,11 +31,11 @@ module Primer
31
31
 
32
32
  VARIANT_MAPPINGS = {
33
33
  large: "Label--large",
34
- inline: "Label--inline",
34
+ inline: "Label--inline"
35
35
  }.freeze
36
36
  VARIANT_OPTIONS = VARIANT_MAPPINGS.keys << nil
37
37
 
38
- # @example 40|Schemes
38
+ # @example Schemes
39
39
  # <%= render(Primer::LabelComponent.new(title: "Label: Label")) { "default" } %>
40
40
  # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :gray)) { "gray" } %>
41
41
  # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :dark_gray)) { "dark_gray" } %>
@@ -43,7 +43,7 @@ module Primer
43
43
  # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :green)) { "green" } %>
44
44
  # <%= render(Primer::LabelComponent.new(title: "Label: Label", scheme: :purple)) { "purple" } %>
45
45
  #
46
- # @example 40|Variants
46
+ # @example Variants
47
47
  # <%= render(Primer::LabelComponent.new(title: "Label: Label")) { "Default" } %>
48
48
  # <%= render(Primer::LabelComponent.new(title: "Label: Label", variant: :large)) { "Large" } %>
49
49
  #
@@ -12,13 +12,13 @@ module Primer
12
12
  DEFAULT_SIDEBAR_COL = 3
13
13
  ALLOWED_SIDEBAR_COLS = (1..(MAX_COL - 1)).to_a.freeze
14
14
 
15
- # @example 40|Default
15
+ # @example Default
16
16
  # <%= render(Primer::LayoutComponent.new) do |component| %>
17
17
  # <% component.with(:sidebar) { "Sidebar" } %>
18
18
  # <% component.with(:main) { "Main" } %>
19
19
  # <% end %>
20
20
  #
21
- # @example 40|Left sidebar
21
+ # @example Left sidebar
22
22
  # <%= render(Primer::LayoutComponent.new(side: :left)) do |component| %>
23
23
  # <% component.with(:sidebar) { "Sidebar" } %>
24
24
  # <% component.with(:main) { "Main" } %>
@@ -3,10 +3,10 @@
3
3
  module Primer
4
4
  # Use links for moving from one page to another. The Link component styles anchor tags with default blue styling and hover text-decoration.
5
5
  class LinkComponent < Primer::Component
6
- # @example 40|Default
6
+ # @example Default
7
7
  # <%= render(Primer::LinkComponent.new(href: "http://www.google.com")) { "Link" } %>
8
8
  #
9
- # @example 40|Muted
9
+ # @example Muted
10
10
  # <%= render(Primer::LinkComponent.new(href: "http://www.google.com", muted: true)) { "Link" } %>
11
11
  #
12
12
  # @param href [String] URL to be used for the Link
@@ -25,5 +25,9 @@ module Primer
25
25
  def call
26
26
  render(Primer::BaseComponent.new(**@system_arguments)) { content }
27
27
  end
28
+
29
+ def self.status
30
+ Primer::Component::STATUSES[:beta]
31
+ end
28
32
  end
29
33
  end
@@ -0,0 +1,293 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ # Use MarkdownComponent to wrap markdown content
5
+ class MarkdownComponent < Primer::Component
6
+ # @example Default
7
+ # <%= render(Primer::MarkdownComponent.new) do %>
8
+ # <p>Text can be <b>bold</b>, <i>italic</i>, or <s>strikethrough</s>. <a href="https://github.com">Links </a> should be blue with no underlines (unless hovered over).</p>
9
+ #
10
+ # <p>There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs.</p>
11
+ #
12
+ # <p>There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs.</p>
13
+ #
14
+ # <blockquote>
15
+ # <p>There should be no margin above this first sentence.</p>
16
+ # <p>Blockquotes should be a lighter gray with a gray border along the left side.</p>
17
+ # <p>There should be no margin below this final sentence.</p>
18
+ # </blockquote>
19
+ #
20
+ # <h1>Header 1</h1>
21
+ #
22
+ # <p>This is a normal paragraph following a header. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.</p>
23
+ #
24
+ # <h2>Header 2</h2>
25
+ #
26
+ # <blockquote>This is a blockquote following a header. Bacon ipsum dolor sit amet t-bone doner shank drumstick, pork belly porchetta chuck sausage brisket ham hock rump pig. Chuck kielbasa leberkas, pork bresaola ham hock filet mignon cow shoulder short ribs biltong.</blockquote>
27
+ #
28
+ # <h3>Header 3</h3>
29
+ #
30
+ # <pre><code>This is a code block following a header.</code></pre>
31
+ #
32
+ # <h4>Header 4</h4>
33
+ #
34
+ # <ul>
35
+ # <li>This is an unordered list following a header.</li>
36
+ # <li>This is an unordered list following a header.</li>
37
+ # <li>This is an unordered list following a header.</li>
38
+ # </ul>
39
+ #
40
+ # <h5>Header 5</h5>
41
+ #
42
+ # <ol>
43
+ # <li>This is an ordered list following a header.</li>
44
+ # <li>This is an ordered list following a header.</li>
45
+ # <li>This is an ordered list following a header.</li>
46
+ # </ol>
47
+ #
48
+ # <h6>Header 6</h6>
49
+ #
50
+ # <table>
51
+ # <thead>
52
+ # <tr>
53
+ # <th>What</th>
54
+ # <th>Follows</th>
55
+ # </tr>
56
+ # </thead>
57
+ # <tbody>
58
+ # <tr>
59
+ # <td>A table</td>
60
+ # <td>A header</td>
61
+ # </tr>
62
+ # <tr>
63
+ # <td>A table</td>
64
+ # <td>A header</td>
65
+ # </tr>
66
+ # <tr>
67
+ # <td>A table</td>
68
+ # <td>A header</td>
69
+ # </tr>
70
+ # </tbody>
71
+ # </table>
72
+ #
73
+ # <hr />
74
+ #
75
+ # <p>There's a horizontal rule above and below this.</p>
76
+ #
77
+ # <hr />
78
+ #
79
+ # <p>Here is an unordered list:</p>
80
+ #
81
+ # <ul>
82
+ # <li>Salt-n-Pepa</li>
83
+ # <li>Bel Biv DeVoe</li>
84
+ # <li>Kid 'N Play</li>
85
+ # </ul>
86
+ #
87
+ # <p>And an ordered list:</p>
88
+ #
89
+ # <ol>
90
+ # <li>Michael Jackson</li>
91
+ # <li>Michael Bolton</li>
92
+ # <li>Michael Buble</li>
93
+ # </ol>
94
+ #
95
+ # <p>And an unordered task list:</p>
96
+ #
97
+ # <ul>
98
+ # <li><input type="checkbox" checked /> Create a sample markdown document</li>
99
+ # <li><input type="checkbox"/> Add task lists to it</li>
100
+ # <li><input type="checkbox"/> Take a vacation</li>
101
+ # </ul>
102
+ #
103
+ # <p>And a "mixed" task list:</p>
104
+ #
105
+ # <ul>
106
+ # <li><input type="checkbox"/> Steal underpants</li>
107
+ # <li>?</li>
108
+ # <li><input type="checkbox"/> Profit!</li>
109
+ # </ul>
110
+ #
111
+ # And a nested list:
112
+ #
113
+ # <ul>
114
+ # <li>Jackson 5
115
+ # <ul>
116
+ # <li>Michael</li>
117
+ # <li>Tito</li>
118
+ # <li>Jackie</li>
119
+ # <li>Marlon</li>
120
+ # <li>Jermaine</li>
121
+ # </ul>
122
+ # </li>
123
+ # <li>TMNT
124
+ # <ul>
125
+ # <li>Leonardo</li>
126
+ # <li>Michelangelo</li>
127
+ # <li>Donatello</li>
128
+ # <li>Raphael</li>
129
+ # </ul>
130
+ # </li>
131
+ # </ul>
132
+ #
133
+ # <p>Definition lists can be used with HTML syntax. Definition terms are bold and italic.</p>
134
+ #
135
+ # <dl>
136
+ # <dt>Name</dt>
137
+ # <dd>Godzilla</dd>
138
+ # <dt>Born</dt>
139
+ # <dd>1952</dd>
140
+ # <dt>Birthplace</dt>
141
+ # <dd>Japan</dd>
142
+ # <dt>Color</dt>
143
+ # <dd>Green</dd>
144
+ # </dl>
145
+ #
146
+ # <hr />
147
+ #
148
+ # <p>Tables should have bold headings and alternating shaded rows.</p>
149
+ #
150
+ # <table>
151
+ # <thead>
152
+ # <tr>
153
+ # <th>Artist</th>
154
+ # <th>Album</th>
155
+ # <th>Year</th>
156
+ # </tr>
157
+ # </thead>
158
+ # <tbody>
159
+ # <tr>
160
+ # <td>David Bowie</td>
161
+ # <td>Scary Monsters</td>
162
+ # <td>1980</td>
163
+ # </tr>
164
+ # <tr>
165
+ # <td>Prince</td>
166
+ # <td>Purple Rain</td>
167
+ # <td>1982</td>
168
+ # </tr>
169
+ # <tr>
170
+ # <td>Beastie Boys</td>
171
+ # <td>License to Ill</td>
172
+ # <td>1986</td>
173
+ # </tr>
174
+ # <tr>
175
+ # <td>Janet Jackson</td>
176
+ # <td>Rhythm Nation 1814</td>
177
+ # <td>1989</td>
178
+ # </tr>
179
+ # </tbody>
180
+ # </table>
181
+ #
182
+ # <p>If a table is too wide, it should condense down and/or scroll horizontally.</p>
183
+ #
184
+ # <table>
185
+ # <thead>
186
+ # <tr>
187
+ # <th>Artist</th>
188
+ # <th>Album</th>
189
+ # <th>Year</th>
190
+ # <th>Label</th>
191
+ # <th>Songs</th>
192
+ # </tr>
193
+ # </thead>
194
+ # <tbody>
195
+ # <tr>
196
+ # <td>David Bowie</td>
197
+ # <td>Scary Monsters</td>
198
+ # <td>1980</td>
199
+ # <td>RCA Records</td>
200
+ # <td>It's No Game (No. 1), Up the Hill Backwards, Scary Monsters (And Super Creeps), Ashes to Ashes, Fashion, Teenage Wildlife, Scream Like a Baby, Kingdom Come, Because You're Young, It's No Game (No. 2)</td>
201
+ # </tr>
202
+ # <tr>
203
+ # <td>Prince</td>
204
+ # <td>Purple Rain</td>
205
+ # <td>1982</td>
206
+ # <td>Warner Brothers Records</td>
207
+ # <td>Let's Go Crazy, Take Me With U, The Beautiful Ones, Computer Blue, Darling Nikki, When Doves Cry, I Would Die 4 U, Baby I'm a Star, Purple Rain</td>
208
+ # </tr>
209
+ # <tr>
210
+ # <td>Beastie Boys</td>
211
+ # <td>License to Ill</td>
212
+ # <td>1986</td>
213
+ # <td>Def Jam</td>
214
+ # <td>Rhymin &amp; Stealin, The New Style, She's Crafty, Posse in Effect, Slow Ride, Girls, Fight for Your Right, No Sleep till Brooklyn, Paul Revere, "Hold It Now, Hit It", Brass Monkey, Slow and Low, Time to Get Ill</td>
215
+ # </tr>
216
+ # <tr>
217
+ # <td>Janet Jackson</td>
218
+ # <td>Rhythm Nation 1814</td>
219
+ # <td>1989</td>
220
+ # <td>A&amp;M</td>
221
+ # <td>Interlude: Pledge, Rhythm Nation, Interlude: T.V., State of the World, Interlude: Race, The Knowledge, Interlude: Let's Dance, Miss You Much, Interlude: Come Back, Love Will Never Do (Without You), Livin' in a World (They Didn't Make), Alright, Interlude: Hey Baby, Escapade, Interlude: No Acid, Black Cat, Lonely, Come Back to Me, Someday Is Tonight, Interlude: Livin'...In Complete Darkness</td>
222
+ # </tr>
223
+ # </tbody>
224
+ # </table>
225
+ #
226
+ # <hr />
227
+ #
228
+ # <p>Code snippets like <code>var foo = "bar";</code> can be shown inline.</p>
229
+ #
230
+ # <p>Also, <code>this should vertically align</code> <s><code>with this</code></s> <s>and this</s>.</p>
231
+ #
232
+ # <p>Code can also be shown in a block element.</p>
233
+ #
234
+ # <pre><code>var foo = "bar";</code></pre>
235
+ #
236
+ # <p>Code can also use syntax highlighting.</p>
237
+ #
238
+ # <pre><code class="prism-code language-javascript">var foo = "bar";</code></pre>
239
+ #
240
+ # <pre><code>Long, single-line code blocks should not wrap. They should horizontally scroll if they are too long. This line should be long enough to demonstrate this.</code></pre>
241
+ #
242
+ # <pre><code class="prism-code language-javascript">var foo = "The same thing is true for code with syntax highlighting. A single line of code should horizontally scroll if it is really long.";</code></pre>
243
+ #
244
+ # <p>Inline code inside table cells should still be distinguishable.</p>
245
+ #
246
+ # <table>
247
+ # <thead>
248
+ # <tr>
249
+ # <th>Language</th>
250
+ # <th>Code</th>
251
+ # </tr>
252
+ # </thead>
253
+ # <tbody>
254
+ # <tr>
255
+ # <td>JavasScript</td>
256
+ # <td><code>var foo = "bar";</code></td>
257
+ # </tr>
258
+ # <tr>
259
+ # <td>Ruby</td>
260
+ # <td><code>foo = "bar"</code></td>
261
+ # </tr>
262
+ # </tbody>
263
+ # </table>
264
+ #
265
+ # <hr />
266
+ #
267
+ # <p>Small images should be shown at their actual size.</p>
268
+ #
269
+ # <p><img src="http://placekitten.com/g/300/200/"/></p>
270
+ #
271
+ # <p>Large images should always scale down and fit in the content container.</p>
272
+ #
273
+ # <p><img src="http://placekitten.com/g/1200/800/"/></p>
274
+ #
275
+ # <pre><code>This is the final element on the page and there should be no margin below this.</code></pre>
276
+ # <% end %>
277
+ #
278
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
279
+ def initialize(**system_arguments)
280
+ @system_arguments = system_arguments
281
+ @system_arguments[:tag] ||= :div
282
+
283
+ @system_arguments[:classes] = class_names(
284
+ "markdown-body",
285
+ system_arguments[:classes]
286
+ )
287
+ end
288
+
289
+ def call
290
+ render(Primer::BaseComponent.new(**@system_arguments)) { content }
291
+ end
292
+ end
293
+ end
@@ -0,0 +1,6 @@
1
+ <%= render(Primer::BaseComponent.new(**@system_arguments)) do %>
2
+ <%= heading %>
3
+ <% items.each do |item| %>
4
+ <%= item %>
5
+ <% end %>
6
+ <% end %>
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ # Use menus to create vertical lists of navigational links.
5
+ class MenuComponent < Primer::Component
6
+ include ViewComponent::SlotableV2
7
+
8
+ # Optional menu heading
9
+ #
10
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
11
+ renders_one :heading, lambda { |**system_arguments|
12
+ system_arguments[:tag] ||= :span
13
+ system_arguments[:classes] = class_names(
14
+ "menu-heading",
15
+ system_arguments[:classes]
16
+ )
17
+
18
+ Primer::BaseComponent.new(**system_arguments)
19
+ }
20
+
21
+ # Required list of navigational links
22
+ #
23
+ # @param href [String] URL to be used for the Link
24
+ # @param selected [Boolean] Whether the item is the current selection
25
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
26
+ renders_many :items, lambda { |href:, selected: false, **system_arguments|
27
+ system_arguments[:tag] = :a
28
+ system_arguments[:href] = href
29
+ system_arguments[:"aria-current"] = :page if selected
30
+ system_arguments[:classes] = class_names(
31
+ "menu-item",
32
+ system_arguments[:classes]
33
+ )
34
+
35
+ Primer::BaseComponent.new(**system_arguments)
36
+ }
37
+
38
+ # @example Default
39
+ # <%= render(Primer::MenuComponent.new) do |c| %>
40
+ # <% c.heading do %>
41
+ # Heading
42
+ # <% end %>
43
+ # <% c.item(selected: true, href: "#url") do %>
44
+ # Item 1
45
+ # <% end %>
46
+ # <% c.item(href: "#url") do %>
47
+ # <%= render(Primer::OcticonComponent.new(icon: "check")) %>
48
+ # With Icon
49
+ # <% end %>
50
+ # <% c.item(href: "#url") do %>
51
+ # <%= render(Primer::OcticonComponent.new(icon: "check")) %>
52
+ # With Icon and Counter
53
+ # <%= render(Primer::CounterComponent.new(count: 25)) %>
54
+ # <% end %>
55
+ # <% end %>
56
+ #
57
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
58
+ def initialize(**system_arguments)
59
+ @system_arguments = system_arguments
60
+ @system_arguments[:tag] = :nav
61
+ @system_arguments[:classes] = class_names(
62
+ "menu",
63
+ @system_arguments[:classes]
64
+ )
65
+ end
66
+
67
+ def render?
68
+ items.any?
69
+ end
70
+ end
71
+ end