primer_view_components 0.0.104 → 0.0.105

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/app/assets/javascripts/primer_view_components.js +1 -1
  4. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  5. data/app/assets/styles/primer_view_components.css +1 -1
  6. data/app/assets/styles/primer_view_components.css.map +1 -1
  7. data/app/components/primer/alpha/action_list/item.rb +2 -2
  8. data/app/components/primer/alpha/action_list.rb +2 -0
  9. data/app/components/primer/alpha/image.rb +50 -0
  10. data/app/components/primer/{image_crop.d.ts → alpha/image_crop.d.ts} +0 -0
  11. data/app/components/primer/{image_crop.html.erb → alpha/image_crop.html.erb} +0 -0
  12. data/app/components/primer/{image_crop.js → alpha/image_crop.js} +0 -0
  13. data/app/components/primer/alpha/image_crop.rb +39 -0
  14. data/app/components/primer/{image_crop.ts → alpha/image_crop.ts} +0 -0
  15. data/app/components/primer/alpha/nav_list/item.rb +2 -0
  16. data/app/components/primer/alpha/nav_list/section.rb +2 -0
  17. data/app/components/primer/alpha/segmented_control/item.html.erb +13 -0
  18. data/app/components/primer/alpha/segmented_control/item.rb +29 -0
  19. data/app/components/primer/alpha/segmented_control.css +1 -0
  20. data/app/components/primer/alpha/segmented_control.css.map +1 -0
  21. data/app/components/primer/alpha/segmented_control.d.ts +11 -0
  22. data/app/components/primer/alpha/segmented_control.html.erb +7 -0
  23. data/app/components/primer/alpha/segmented_control.js +48 -0
  24. data/app/components/primer/alpha/segmented_control.pcss +121 -0
  25. data/app/components/primer/alpha/segmented_control.rb +92 -0
  26. data/app/components/primer/alpha/segmented_control.ts +41 -0
  27. data/app/components/primer/alpha/tooltip.rb +2 -2
  28. data/app/components/primer/beta/auto_complete/item.rb +2 -2
  29. data/app/components/primer/beta/avatar.rb +1 -1
  30. data/app/components/primer/beta/blankslate.rb +4 -4
  31. data/app/components/primer/beta/breadcrumbs.rb +1 -1
  32. data/app/components/primer/beta/button.rb +1 -1
  33. data/app/components/primer/beta/label.rb +100 -0
  34. data/app/components/primer/beta/link.rb +99 -0
  35. data/app/components/primer/component.rb +1 -0
  36. data/app/components/primer/image.rb +2 -41
  37. data/app/components/primer/image_crop.rb +2 -32
  38. data/app/components/primer/label_component.rb +2 -93
  39. data/app/components/primer/link_component.rb +2 -92
  40. data/app/components/primer/primer.d.ts +2 -1
  41. data/app/components/primer/primer.js +2 -1
  42. data/app/components/primer/primer.pcss +1 -0
  43. data/app/components/primer/primer.ts +2 -1
  44. data/app/components/primer/subhead_component.rb +1 -1
  45. data/app/components/primer/time_ago_component.rb +2 -0
  46. data/app/helpers/primer/form_helper.rb +1 -0
  47. data/app/lib/primer/view_helper.rb +1 -1
  48. data/lib/primer/deprecations.rb +4 -0
  49. data/lib/primer/form_components.rb +1 -0
  50. data/lib/primer/view_components/linters/argument_mappers/label.rb +4 -4
  51. data/lib/primer/view_components/linters/label_component_migration_counter.rb +3 -3
  52. data/lib/primer/view_components/version.rb +1 -1
  53. data/lib/rubocop/config/default.yml +0 -3
  54. data/lib/rubocop/cop/primer/deprecated_label_schemes.rb +3 -3
  55. data/lib/rubocop/cop/primer/deprecated_label_variants.rb +5 -5
  56. data/lib/tasks/docs.rake +12 -7
  57. data/lib/tasks/test.rake +23 -26
  58. data/previews/primer/alpha/action_list_preview.rb +29 -0
  59. data/previews/primer/alpha/auto_complete_preview.rb +10 -0
  60. data/previews/primer/alpha/button_marketing_preview.rb +9 -0
  61. data/previews/primer/alpha/dialog_preview.rb +18 -1
  62. data/previews/primer/alpha/hidden_text_expander_preview.rb +7 -0
  63. data/previews/primer/alpha/image_crop_preview.rb +31 -0
  64. data/previews/primer/alpha/layout_preview.rb +15 -0
  65. data/previews/primer/alpha/nav_list_preview.rb +29 -0
  66. data/previews/primer/alpha/segmented_control_preview.rb +75 -0
  67. data/previews/primer/alpha/tab_panels_preview.rb +15 -0
  68. data/previews/primer/alpha/text_field_preview.rb +58 -0
  69. data/previews/primer/alpha/toggle_switch_preview.rb +4 -0
  70. data/previews/primer/alpha/tooltip_preview.rb +13 -3
  71. data/previews/primer/alpha/underline_nav_preview/playground.html.erb +8 -0
  72. data/previews/primer/alpha/underline_nav_preview.rb +15 -0
  73. data/previews/primer/alpha/underline_panels_preview.rb +15 -0
  74. data/previews/primer/beta/auto_complete_item_preview/playground.html.erb +9 -0
  75. data/previews/primer/beta/auto_complete_item_preview.rb +14 -0
  76. data/previews/primer/beta/auto_complete_preview.rb +20 -0
  77. data/previews/primer/beta/avatar_preview.rb +9 -0
  78. data/previews/primer/beta/avatar_stack_preview.rb +15 -0
  79. data/previews/primer/beta/base_button_preview.rb +9 -0
  80. data/previews/primer/beta/blankslate_preview.rb +12 -0
  81. data/previews/primer/beta/border_box_preview.rb +14 -0
  82. data/previews/primer/beta/breadcrumbs_preview.rb +11 -0
  83. data/previews/primer/beta/button_group_preview.rb +12 -0
  84. data/previews/primer/beta/close_button_preview.rb +7 -0
  85. data/previews/primer/beta/counter_preview.rb +11 -0
  86. data/previews/primer/beta/details_preview.rb +15 -0
  87. data/previews/primer/beta/flash_preview.rb +12 -0
  88. data/previews/primer/beta/heading_preview.rb +8 -0
  89. data/previews/primer/beta/label_preview.rb +26 -0
  90. data/previews/primer/beta/link_preview.rb +41 -0
  91. data/previews/primer/beta/text_preview.rb +8 -0
  92. data/previews/primer/beta/truncate_preview.rb +7 -0
  93. data/previews/primer/clipboard_copy_preview.rb +8 -0
  94. data/previews/primer/dropdown_preview.rb +18 -0
  95. data/previews/primer/hellip_button_preview.rb +8 -0
  96. data/previews/primer/layout_component_preview.rb +13 -1
  97. data/previews/primer/local_time_component_preview.rb +13 -0
  98. data/previews/primer/markdown_preview.rb +277 -266
  99. data/previews/primer/menu_component_preview/playground.html.erb +17 -0
  100. data/previews/primer/menu_component_preview.rb +4 -1
  101. data/previews/primer/octicon_component_preview.rb +8 -0
  102. data/previews/primer/popover_component_preview.rb +15 -1
  103. data/previews/primer/progress_bar_component_preview.rb +12 -1
  104. data/previews/primer/spinner_component_preview.rb +7 -0
  105. data/previews/primer/state_component_preview.rb +11 -1
  106. data/previews/primer/subhead_component_preview.rb +17 -0
  107. data/previews/primer/time_ago_component_preview.rb +8 -0
  108. data/previews/primer/timeline_item_component_preview.rb +12 -1
  109. data/static/arguments.json +300 -138
  110. data/static/audited_at.json +6 -0
  111. data/static/constants.json +86 -71
  112. data/static/statuses.json +10 -4
  113. metadata +27 -9
  114. data/previews/primer/image_crop_preview.rb +0 -22
  115. data/previews/primer/label_component_preview.rb +0 -15
  116. data/previews/primer/link_component_preview.rb +0 -29
@@ -3,277 +3,288 @@
3
3
  module Primer
4
4
  # @label Markdown
5
5
  class MarkdownPreview < ViewComponent::Preview
6
- # @label Default Options
7
- def default
8
- render(Primer::Markdown.new) do
9
- "<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>
6
+ MD_FIXTURE = %(
7
+ <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>
10
8
 
11
- <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>
9
+ <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>
12
10
 
13
- <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
+ <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>
14
12
 
15
- <blockquote>
16
- <p>There should be no margin above this first sentence.</p>
17
- <p>Blockquotes should be a lighter gray with a gray border along the left side.</p>
18
- <p>There should be no margin below this final sentence.</p>
19
- </blockquote>
13
+ <blockquote>
14
+ <p>There should be no margin above this first sentence.</p>
15
+ <p>Blockquotes should be a lighter gray with a gray border along the left side.</p>
16
+ <p>There should be no margin below this final sentence.</p>
17
+ </blockquote>
20
18
 
21
- <h1>Header 1</h1>
19
+ <h1>Header 1</h1>
20
+
21
+ <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>
22
+
23
+ <h2>Header 2</h2>
24
+
25
+ <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>
26
+
27
+ <h3>Header 3</h3>
28
+
29
+ <pre><code>This is a code block following a header.</code></pre>
30
+
31
+ <h4>Header 4</h4>
32
+
33
+ <ul>
34
+ <li>This is an unordered list following a header.</li>
35
+ <li>This is an unordered list following a header.</li>
36
+ <li>This is an unordered list following a header.</li>
37
+ </ul>
38
+
39
+ <h5>Header 5</h5>
40
+
41
+ <ol>
42
+ <li>This is an ordered list following a header.</li>
43
+ <li>This is an ordered list following a header.</li>
44
+ <li>This is an ordered list following a header.</li>
45
+ </ol>
46
+
47
+ <h6>Header 6</h6>
48
+
49
+ <table>
50
+ <thead>
51
+ <tr>
52
+ <th>What</th>
53
+ <th>Follows</th>
54
+ </tr>
55
+ </thead>
56
+ <tbody>
57
+ <tr>
58
+ <td>A table</td>
59
+ <td>A header</td>
60
+ </tr>
61
+ <tr>
62
+ <td>A table</td>
63
+ <td>A header</td>
64
+ </tr>
65
+ <tr>
66
+ <td>A table</td>
67
+ <td>A header</td>
68
+ </tr>
69
+ </tbody>
70
+ </table>
71
+
72
+ <hr />
73
+
74
+ <p>There's a horizontal rule above and below this.</p>
75
+
76
+ <hr />
77
+
78
+ <p>Here is an unordered list:</p>
79
+
80
+ <ul>
81
+ <li>Salt-n-Pepa</li>
82
+ <li>Bel Biv DeVoe</li>
83
+ <li>Kid 'N Play</li>
84
+ </ul>
85
+
86
+ <p>And an ordered list:</p>
87
+
88
+ <ol>
89
+ <li>Michael Jackson</li>
90
+ <li>Michael Bolton</li>
91
+ <li>Michael Bublé</li>
92
+ </ol>
93
+
94
+ <p>And an unordered task list:</p>
95
+
96
+ <ul>
97
+ <li><input type=\"checkbox\" checked> Create a sample markdown document</li>
98
+ <li><input type=\"checkbox\"> Add task lists to it</li>
99
+ <li><input type=\"checkbox\"> Take a vacation</li>
100
+ </ul>
101
+
102
+ <p>And a \"mixed\" task list:</p>
103
+
104
+ <ul>
105
+ <li><input type=\"checkbox\"> Steal underpants</li>
106
+ <li>?</li>
107
+ <li><input type=\"checkbox\"> Profit!</li>
108
+ </ul>
109
+
110
+ And a nested list:
111
+
112
+ <ul>
113
+ <li>Jackson 5
114
+ <ul>
115
+ <li>Michael</li>
116
+ <li>Tito</li>
117
+ <li>Jackie</li>
118
+ <li>Marlon</li>
119
+ <li>Jermaine</li>
120
+ </ul>
121
+ </li>
122
+ <li>TMNT
123
+ <ul>
124
+ <li>Leonardo</li>
125
+ <li>Michelangelo</li>
126
+ <li>Donatello</li>
127
+ <li>Raphael</li>
128
+ </ul>
129
+ </li>
130
+ </ul>
131
+
132
+ <p>Definition lists can be used with HTML syntax. Definition terms are bold and italic.</p>
133
+
134
+ <dl>
135
+ <dt>Name</dt>
136
+ <dd>Godzilla</dd>
137
+ <dt>Born</dt>
138
+ <dd>1952</dd>
139
+ <dt>Birthplace</dt>
140
+ <dd>Japan</dd>
141
+ <dt>Color</dt>
142
+ <dd>Green</dd>
143
+ </dl>
144
+
145
+ <hr />
146
+
147
+ <p>Tables should have bold headings and alternating shaded rows.</p>
148
+
149
+ <table>
150
+ <thead>
151
+ <tr>
152
+ <th>Artist</th>
153
+ <th>Album</th>
154
+ <th>Year</th>
155
+ </tr>
156
+ </thead>
157
+ <tbody>
158
+ <tr>
159
+ <td>David Bowie</td>
160
+ <td>Scary Monsters</td>
161
+ <td>1980</td>
162
+ </tr>
163
+ <tr>
164
+ <td>Prince</td>
165
+ <td>Purple Rain</td>
166
+ <td>1982</td>
167
+ </tr>
168
+ <tr>
169
+ <td>Beastie Boys</td>
170
+ <td>License to Ill</td>
171
+ <td>1986</td>
172
+ </tr>
173
+ <tr>
174
+ <td>Janet Jackson</td>
175
+ <td>Rhythm Nation 1814</td>
176
+ <td>1989</td>
177
+ </tr>
178
+ </tbody>
179
+ </table>
180
+
181
+ <p>If a table is too wide, it should condense down and/or scroll horizontally.</p>
182
+
183
+ <table>
184
+ <thead>
185
+ <tr>
186
+ <th>Artist</th>
187
+ <th>Album</th>
188
+ <th>Year</th>
189
+ <th>Label</th>
190
+ <th>Songs</th>
191
+ </tr>
192
+ </thead>
193
+ <tbody>
194
+ <tr>
195
+ <td>David Bowie</td>
196
+ <td>Scary Monsters</td>
197
+ <td>1980</td>
198
+ <td>RCA Records</td>
199
+ <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>
200
+ </tr>
201
+ <tr>
202
+ <td>Prince</td>
203
+ <td>Purple Rain</td>
204
+ <td>1982</td>
205
+ <td>Warner Brothers Records</td>
206
+ <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>
207
+ </tr>
208
+ <tr>
209
+ <td>Beastie Boys</td>
210
+ <td>License to Ill</td>
211
+ <td>1986</td>
212
+ <td>Def Jam</td>
213
+ <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>
214
+ </tr>
215
+ <tr>
216
+ <td>Janet Jackson</td>
217
+ <td>Rhythm Nation 1814</td>
218
+ <td>1989</td>
219
+ <td>A&amp;M</td>
220
+ <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>
221
+ </tr>
222
+ </tbody>
223
+ </table>
224
+
225
+ <hr />
226
+
227
+ <p>Code snippets like <code>var foo = \"bar\";</code> can be shown inline.</p>
228
+
229
+ <p>Also, <code>this should vertically align</code> <s><code>with this</code></s> <s>and this</s>.</p>
230
+
231
+ <p>Code can also be shown in a block element.</p>
232
+
233
+ <pre><code>var foo = \"bar\";</code></pre>
234
+
235
+ <p>Code can also use syntax highlighting.</p>
236
+
237
+ <pre><code>var foo = \"bar\";</code></pre>
238
+
239
+ <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>
240
+
241
+ <pre><code>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>
242
+
243
+ <p>Inline code inside table cells should still be distinguishable.</p>
244
+
245
+ <table>
246
+ <thead>
247
+ <tr>
248
+ <th>Language</th>
249
+ <th>Code</th>
250
+ </tr>
251
+ </thead>
252
+ <tbody>
253
+ <tr>
254
+ <td>JavasScript</td>
255
+ <td><code>var foo = \"bar\";</code></td>
256
+ </tr>
257
+ <tr>
258
+ <td>Ruby</td>
259
+ <td><code>foo = \"bar\"</code></td>
260
+ </tr>
261
+ </tbody>
262
+ </table>
263
+
264
+ <hr />
265
+
266
+ <p>Small images should be shown at their actual size.</p>
267
+
268
+ <!-- p><img src=\"http://placekitten.com/g/300/200/\"></!-->
269
+
270
+ <p>Large images should always scale down and fit in the content container.</p>
271
+
272
+ <!-- p><img src=\"http://placekitten.com/g/1200/800/\"></!-->
273
+
274
+ <pre><code>This is the final element on the page and there should be no margin below this.</code></pre>
275
+ ).html_safe # rubocop:disable Rails/OutputSafety
276
+
277
+ # @label Playground
278
+ def playground
279
+ render(Primer::Markdown.new) do
280
+ MD_FIXTURE
281
+ end
282
+ end
22
283
 
23
- <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>
24
-
25
- <h2>Header 2</h2>
26
-
27
- <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>
28
-
29
- <h3>Header 3</h3>
30
-
31
- <pre><code>This is a code block following a header.</code></pre>
32
-
33
- <h4>Header 4</h4>
34
-
35
- <ul>
36
- <li>This is an unordered list following a header.</li>
37
- <li>This is an unordered list following a header.</li>
38
- <li>This is an unordered list following a header.</li>
39
- </ul>
40
-
41
- <h5>Header 5</h5>
42
-
43
- <ol>
44
- <li>This is an ordered list following a header.</li>
45
- <li>This is an ordered list following a header.</li>
46
- <li>This is an ordered list following a header.</li>
47
- </ol>
48
-
49
- <h6>Header 6</h6>
50
-
51
- <table>
52
- <thead>
53
- <tr>
54
- <th>What</th>
55
- <th>Follows</th>
56
- </tr>
57
- </thead>
58
- <tbody>
59
- <tr>
60
- <td>A table</td>
61
- <td>A header</td>
62
- </tr>
63
- <tr>
64
- <td>A table</td>
65
- <td>A header</td>
66
- </tr>
67
- <tr>
68
- <td>A table</td>
69
- <td>A header</td>
70
- </tr>
71
- </tbody>
72
- </table>
73
-
74
- <hr />
75
-
76
- <p>There's a horizontal rule above and below this.</p>
77
-
78
- <hr />
79
-
80
- <p>Here is an unordered list:</p>
81
-
82
- <ul>
83
- <li>Salt-n-Pepa</li>
84
- <li>Bel Biv DeVoe</li>
85
- <li>Kid 'N Play</li>
86
- </ul>
87
-
88
- <p>And an ordered list:</p>
89
-
90
- <ol>
91
- <li>Michael Jackson</li>
92
- <li>Michael Bolton</li>
93
- <li>Michael Bublé</li>
94
- </ol>
95
-
96
- <p>And an unordered task list:</p>
97
-
98
- <ul>
99
- <li><input type=\"checkbox\" checked> Create a sample markdown document</li>
100
- <li><input type=\"checkbox\"> Add task lists to it</li>
101
- <li><input type=\"checkbox\"> Take a vacation</li>
102
- </ul>
103
-
104
- <p>And a \"mixed\" task list:</p>
105
-
106
- <ul>
107
- <li><input type=\"checkbox\"> Steal underpants</li>
108
- <li>?</li>
109
- <li><input type=\"checkbox\"> Profit!</li>
110
- </ul>
111
-
112
- And a nested list:
113
-
114
- <ul>
115
- <li>Jackson 5
116
- <ul>
117
- <li>Michael</li>
118
- <li>Tito</li>
119
- <li>Jackie</li>
120
- <li>Marlon</li>
121
- <li>Jermaine</li>
122
- </ul>
123
- </li>
124
- <li>TMNT
125
- <ul>
126
- <li>Leonardo</li>
127
- <li>Michelangelo</li>
128
- <li>Donatello</li>
129
- <li>Raphael</li>
130
- </ul>
131
- </li>
132
- </ul>
133
-
134
- <p>Definition lists can be used with HTML syntax. Definition terms are bold and italic.</p>
135
-
136
- <dl>
137
- <dt>Name</dt>
138
- <dd>Godzilla</dd>
139
- <dt>Born</dt>
140
- <dd>1952</dd>
141
- <dt>Birthplace</dt>
142
- <dd>Japan</dd>
143
- <dt>Color</dt>
144
- <dd>Green</dd>
145
- </dl>
146
-
147
- <hr />
148
-
149
- <p>Tables should have bold headings and alternating shaded rows.</p>
150
-
151
- <table>
152
- <thead>
153
- <tr>
154
- <th>Artist</th>
155
- <th>Album</th>
156
- <th>Year</th>
157
- </tr>
158
- </thead>
159
- <tbody>
160
- <tr>
161
- <td>David Bowie</td>
162
- <td>Scary Monsters</td>
163
- <td>1980</td>
164
- </tr>
165
- <tr>
166
- <td>Prince</td>
167
- <td>Purple Rain</td>
168
- <td>1982</td>
169
- </tr>
170
- <tr>
171
- <td>Beastie Boys</td>
172
- <td>License to Ill</td>
173
- <td>1986</td>
174
- </tr>
175
- <tr>
176
- <td>Janet Jackson</td>
177
- <td>Rhythm Nation 1814</td>
178
- <td>1989</td>
179
- </tr>
180
- </tbody>
181
- </table>
182
-
183
- <p>If a table is too wide, it should condense down and/or scroll horizontally.</p>
184
-
185
- <table>
186
- <thead>
187
- <tr>
188
- <th>Artist</th>
189
- <th>Album</th>
190
- <th>Year</th>
191
- <th>Label</th>
192
- <th>Songs</th>
193
- </tr>
194
- </thead>
195
- <tbody>
196
- <tr>
197
- <td>David Bowie</td>
198
- <td>Scary Monsters</td>
199
- <td>1980</td>
200
- <td>RCA Records</td>
201
- <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>
202
- </tr>
203
- <tr>
204
- <td>Prince</td>
205
- <td>Purple Rain</td>
206
- <td>1982</td>
207
- <td>Warner Brothers Records</td>
208
- <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>
209
- </tr>
210
- <tr>
211
- <td>Beastie Boys</td>
212
- <td>License to Ill</td>
213
- <td>1986</td>
214
- <td>Def Jam</td>
215
- <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>
216
- </tr>
217
- <tr>
218
- <td>Janet Jackson</td>
219
- <td>Rhythm Nation 1814</td>
220
- <td>1989</td>
221
- <td>A&amp;M</td>
222
- <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>
223
- </tr>
224
- </tbody>
225
- </table>
226
-
227
- <hr />
228
-
229
- <p>Code snippets like <code>var foo = \"bar\";</code> can be shown inline.</p>
230
-
231
- <p>Also, <code>this should vertically align</code> <s><code>with this</code></s> <s>and this</s>.</p>
232
-
233
- <p>Code can also be shown in a block element.</p>
234
-
235
- <pre><code>var foo = \"bar\";</code></pre>
236
-
237
- <p>Code can also use syntax highlighting.</p>
238
-
239
- <pre><code>var foo = \"bar\";</code></pre>
240
-
241
- <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>
242
-
243
- <pre><code>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>
244
-
245
- <p>Inline code inside table cells should still be distinguishable.</p>
246
-
247
- <table>
248
- <thead>
249
- <tr>
250
- <th>Language</th>
251
- <th>Code</th>
252
- </tr>
253
- </thead>
254
- <tbody>
255
- <tr>
256
- <td>JavasScript</td>
257
- <td><code>var foo = \"bar\";</code></td>
258
- </tr>
259
- <tr>
260
- <td>Ruby</td>
261
- <td><code>foo = \"bar\"</code></td>
262
- </tr>
263
- </tbody>
264
- </table>
265
-
266
- <hr />
267
-
268
- <p>Small images should be shown at their actual size.</p>
269
-
270
- <!-- p><img src=\"http://placekitten.com/g/300/200/\"></!-->
271
-
272
- <p>Large images should always scale down and fit in the content container.</p>
273
-
274
- <!-- p><img src=\"http://placekitten.com/g/1200/800/\"></!-->
275
-
276
- <pre><code>This is the final element on the page and there should be no margin below this.</code></pre>".html_safe # rubocop:disable Rails/OutputSafety
284
+ # @label Default Options
285
+ def default
286
+ render(Primer::Markdown.new) do
287
+ MD_FIXTURE
277
288
  end
278
289
  end
279
290
  end
@@ -0,0 +1,17 @@
1
+ <%= render(Primer::MenuComponent.new) do |c| %>
2
+ <% c.with_heading(tag: :h2) do %>
3
+ Heading
4
+ <% end %>
5
+ <% c.with_item(selected: true, href: "#url") do %>
6
+ Item 1
7
+ <% end %>
8
+ <% c.with_item(href: "#url") do %>
9
+ <%= render(Primer::OcticonComponent.new("check")) %>
10
+ With Icon
11
+ <% end %>
12
+ <% c.with_item(href: "#url") do %>
13
+ <%= render(Primer::OcticonComponent.new("check")) %>
14
+ With Icon and Counter
15
+ <%= render(Primer::Beta::Counter.new(count: 25)) %>
16
+ <% end %>
17
+ <% end %>
@@ -3,7 +3,10 @@
3
3
  module Primer
4
4
  # @label MenuComponent
5
5
  class MenuComponentPreview < ViewComponent::Preview
6
- # @label Default Options
6
+ # @label Playground
7
+ def playground; end
8
+
9
+ # @label Default
7
10
  def default; end
8
11
  end
9
12
  end
@@ -3,6 +3,14 @@
3
3
  module Primer
4
4
  # @label OcticonComponent
5
5
  class OcticonComponentPreview < ViewComponent::Preview
6
+ # @label Playground
7
+ #
8
+ # @param aria_label [String]
9
+ # @param size [Symbol] select [xsmall, small, medium]
10
+ def playground(size: :small, aria_label: nil)
11
+ render(Primer::OcticonComponent.new(icon: :people, size: size, "aria-label": aria_label))
12
+ end
13
+
6
14
  # @label Default Options
7
15
  #
8
16
  # @param aria_label [String]
@@ -3,7 +3,21 @@
3
3
  module Primer
4
4
  # @label PopoverComponent
5
5
  class PopoverComponentPreview < ViewComponent::Preview
6
- # @label Default Options
6
+ # @label Playground
7
+ #
8
+ # @param caret [Symbol] select [top, right, bottom, left, top_right, top_left, bottom_right, bottom_left, left_bottom, left_top, right_bottom, right_top]
9
+ def playground(caret: :top)
10
+ render Primer::PopoverComponent.new do |component|
11
+ component.with_heading do
12
+ "Activity feed"
13
+ end
14
+ component.with_body(caret: caret) do
15
+ "This is the Popover body."
16
+ end
17
+ end
18
+ end
19
+
20
+ # @label Default
7
21
  #
8
22
  # @param caret [Symbol] select [top, right, bottom, left, top_right, top_left, bottom_right, bottom_left, left_bottom, left_top, right_bottom, right_top]
9
23
  def default(caret: :top)
@@ -3,7 +3,18 @@
3
3
  module Primer
4
4
  # @label ProgressBarComponent
5
5
  class ProgressBarComponentPreview < ViewComponent::Preview
6
- # @label Default Options
6
+ # @label Playground
7
+ #
8
+ # @param size [Symbol] select [default, small, large]
9
+ def playground(size: :default)
10
+ render(Primer::ProgressBarComponent.new(size: size)) do |component|
11
+ component.with_item(percentage: 10)
12
+ component.with_item(bg: :accent_emphasis, percentage: 20)
13
+ component.with_item(bg: :danger_emphasis, percentage: 30)
14
+ end
15
+ end
16
+
17
+ # @label Default
7
18
  #
8
19
  # @param size [Symbol] select [default, small, large]
9
20
  def default(size: :default)
@@ -3,6 +3,13 @@
3
3
  module Primer
4
4
  # @label SpinnerComponent
5
5
  class SpinnerComponentPreview < ViewComponent::Preview
6
+ # @label Playground
7
+ #
8
+ # @param size [Symbol] select [small, medium, large]
9
+ def playground(size: :medium)
10
+ render(Primer::SpinnerComponent.new(size: size))
11
+ end
12
+
6
13
  # @label Default Options
7
14
  #
8
15
  # @param size [Symbol] select [small, medium, large]
@@ -3,7 +3,17 @@
3
3
  module Primer
4
4
  # @label StateComponent
5
5
  class StateComponentPreview < ViewComponent::Preview
6
- # @label Default Options
6
+ # @label Playground
7
+ #
8
+ # @param title [String]
9
+ # @param tag [Symbol] select [span, div]
10
+ # @param size [Symbol] select [default, small]
11
+ # @param scheme [Symbol] select [default, open, closed, merged]
12
+ def playground(title: "State", scheme: :default, size: :default, tag: :span)
13
+ render(Primer::StateComponent.new(title: title, scheme: scheme, size: size, tag: tag)) { "State" }
14
+ end
15
+
16
+ # @label Default
7
17
  #
8
18
  # @param title [String]
9
19
  # @param tag [Symbol] select [span, div]