primer_view_components 0.0.15 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +78 -0
  3. data/app/components/primer/avatar_component.rb +24 -6
  4. data/app/components/primer/avatar_stack_component.html.erb +10 -0
  5. data/app/components/primer/avatar_stack_component.rb +81 -0
  6. data/app/components/primer/base_component.rb +8 -4
  7. data/app/components/primer/blankslate_component.html.erb +4 -4
  8. data/app/components/primer/blankslate_component.rb +34 -8
  9. data/app/components/primer/border_box_component.rb +29 -13
  10. data/app/components/primer/box_component.rb +10 -0
  11. data/app/components/primer/breadcrumb_component.rb +3 -2
  12. data/app/components/primer/button_component.rb +3 -3
  13. data/app/components/primer/button_group_component.html.erb +5 -0
  14. data/app/components/primer/button_group_component.rb +37 -0
  15. data/app/components/primer/button_marketing_component.rb +73 -0
  16. data/app/components/primer/component.rb +13 -0
  17. data/app/components/primer/counter_component.rb +16 -9
  18. data/app/components/primer/details_component.rb +10 -6
  19. data/app/components/primer/dropdown/menu_component.html.erb +12 -0
  20. data/app/components/primer/dropdown/menu_component.rb +48 -0
  21. data/app/components/primer/dropdown_component.html.erb +9 -0
  22. data/app/components/primer/dropdown_component.rb +77 -0
  23. data/app/components/primer/dropdown_menu_component.rb +35 -3
  24. data/app/components/primer/flash_component.rb +10 -7
  25. data/app/components/primer/flex_component.rb +47 -9
  26. data/app/components/primer/flex_item_component.rb +16 -1
  27. data/app/components/primer/heading_component.rb +7 -0
  28. data/app/components/primer/label_component.rb +6 -6
  29. data/app/components/primer/layout_component.rb +2 -2
  30. data/app/components/primer/link_component.rb +7 -3
  31. data/app/components/primer/markdown_component.rb +293 -0
  32. data/app/components/primer/menu_component.html.erb +6 -0
  33. data/app/components/primer/menu_component.rb +71 -0
  34. data/app/components/primer/octicon_component.rb +11 -6
  35. data/app/components/primer/popover_component.rb +6 -4
  36. data/app/components/primer/progress_bar_component.rb +9 -9
  37. data/app/components/primer/slot.rb +1 -0
  38. data/app/components/primer/spinner_component.rb +10 -7
  39. data/app/components/primer/state_component.rb +6 -6
  40. data/app/components/primer/subhead_component.rb +6 -3
  41. data/app/components/primer/text_component.rb +1 -1
  42. data/app/components/primer/timeline_item_component.rb +4 -1
  43. data/app/components/primer/tooltip_component.rb +88 -0
  44. data/app/components/primer/truncate_component.rb +41 -0
  45. data/app/components/primer/underline_nav_component.rb +26 -1
  46. data/app/components/primer/view_components.rb +9 -0
  47. data/lib/primer/class_name_helper.rb +1 -0
  48. data/lib/primer/classify.rb +139 -107
  49. data/lib/primer/classify/cache.rb +125 -0
  50. data/lib/primer/fetch_or_fallback_helper.rb +9 -0
  51. data/lib/primer/join_style_arguments_helper.rb +14 -0
  52. data/lib/primer/view_components.rb +32 -0
  53. data/lib/primer/view_components/engine.rb +1 -0
  54. data/lib/primer/view_components/version.rb +1 -1
  55. data/lib/yard/renders_many_handler.rb +19 -0
  56. data/lib/yard/renders_one_handler.rb +19 -0
  57. data/static/statuses.json +1 -0
  58. metadata +80 -19
@@ -1,18 +1,50 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Primer
4
+ # DropdownMenus are lightweight context menus for housing navigation and actions.
5
+ # They're great for instances where you don't need the full power (and code)
6
+ # of the select menu.
4
7
  class DropdownMenuComponent < Primer::Component
5
8
  SCHEME_DEFAULT = :default
6
9
  SCHEME_MAPPINGS = {
7
10
  SCHEME_DEFAULT => "",
8
- :dark => "dropdown-menu-dark",
11
+ :dark => "dropdown-menu-dark"
9
12
  }.freeze
10
13
 
11
14
  DIRECTION_DEFAULT = :se
12
- DIRECTION_OPTIONS = [DIRECTION_DEFAULT, :sw, :w, :e, :ne, :s]
15
+ DIRECTION_OPTIONS = [DIRECTION_DEFAULT, :sw, :w, :e, :ne, :s].freeze
13
16
 
17
+ def self.status
18
+ STATUSES[:deprecated]
19
+ end
20
+
21
+ # @example 200|With a header
22
+ # <div style="margin-bottom: 150px">
23
+ # <%= render(Primer::DetailsComponent.new(overlay: :default, reset: true, position: :relative)) do |c| %>
24
+ # <% c.slot(:summary) do %>
25
+ # Dropdown
26
+ # <% end %>
27
+ #
28
+ # <% c.slot(:body) do %>
29
+ # <%= render(Primer::DropdownMenuComponent.new(header: "Options")) do %>
30
+ # <ul>
31
+ # <li><a class="dropdown-item" href="#url">Dropdown item</a></li>
32
+ # <li><a class="dropdown-item" href="#url">Dropdown item</a></li>
33
+ # <li><a class="dropdown-item" href="#url">Dropdown item</a></li>
34
+ # </ul>
35
+ # <% end %>
36
+ # <% end %>
37
+ # <% end %>
38
+ # </div>
39
+ #
40
+ # @param direction [Symbol] <%= one_of(Primer::DropdownMenuComponent::DIRECTION_OPTIONS) %>
41
+ # @param scheme [Symbol] Pass :dark for dark mode theming
42
+ # @param header [String] Optional string to display as the header
43
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
14
44
  def initialize(direction: DIRECTION_DEFAULT, scheme: SCHEME_DEFAULT, header: nil, **system_arguments)
15
- @header, @direction, @system_arguments = header, direction, system_arguments
45
+ @header = header
46
+ @direction = direction
47
+ @system_arguments = system_arguments
16
48
 
17
49
  @system_arguments[:tag] = "details-menu"
18
50
  @system_arguments[:role] = "menu"
@@ -14,22 +14,22 @@ module Primer
14
14
  :danger => "flash-error",
15
15
  :success => "flash-success"
16
16
  }.freeze
17
- # @example 280|Variants
17
+ # @example auto|Variants
18
18
  # <%= render(Primer::FlashComponent.new) { "This is a flash message!" } %>
19
19
  # <%= render(Primer::FlashComponent.new(variant: :warning)) { "This is a warning flash message!" } %>
20
20
  # <%= render(Primer::FlashComponent.new(variant: :danger)) { "This is a danger flash message!" } %>
21
21
  # <%= render(Primer::FlashComponent.new(variant: :success)) { "This is a success flash message!" } %>
22
22
  #
23
- # @example 80|Full width
23
+ # @example auto|Full width
24
24
  # <%= render(Primer::FlashComponent.new(full: true)) { "This is a full width flash message!" } %>
25
25
  #
26
- # @example 80|Dismissible
26
+ # @example auto|Dismissible
27
27
  # <%= render(Primer::FlashComponent.new(dismissible: true)) { "This is a dismissible flash message!" } %>
28
28
  #
29
- # @example 80|Icon
29
+ # @example auto|Icon
30
30
  # <%= render(Primer::FlashComponent.new(icon: "people")) { "This is a flash message with an icon!" } %>
31
31
  #
32
- # @example 80|With actions
32
+ # @example auto|With actions
33
33
  # <%= render(Primer::FlashComponent.new) do |component| %>
34
34
  # This is a flash message with actions!
35
35
  # <% component.slot(:actions) do %>
@@ -57,9 +57,12 @@ module Primer
57
57
  @system_arguments[:mb] ||= spacious ? 4 : nil
58
58
  end
59
59
 
60
- class Actions < ViewComponent::Slot
61
- include ClassNameHelper
60
+ def self.status
61
+ Primer::Component::STATUSES[:beta]
62
+ end
62
63
 
64
+ # :nodoc:
65
+ class Actions < Primer::Slot
63
66
  attr_reader :system_arguments
64
67
 
65
68
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
@@ -1,6 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Primer
4
+ # Use FlexComponent to make an element lay out its content using the flexbox model.
5
+ # Before using these utilities, you should be familiar with CSS3 Flexible Box
6
+ # spec. If you are not, check out MDN's guide [Using CSS Flexible
7
+ # Boxes](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox).
4
8
  class FlexComponent < Primer::Component
5
9
  JUSTIFY_CONTENT_DEFAULT = nil
6
10
  JUSTIFY_CONTENT_MAPPINGS = {
@@ -8,9 +12,9 @@ module Primer
8
12
  flex_end: "flex-justify-end",
9
13
  center: "flex-justify-center",
10
14
  space_between: "flex-justify-between",
11
- space_around: "flex-justify-around",
12
- }
13
- JUSTIFY_CONTENT_OPTIONS = [JUSTIFY_CONTENT_DEFAULT, *JUSTIFY_CONTENT_MAPPINGS.keys]
15
+ space_around: "flex-justify-around"
16
+ }.freeze
17
+ JUSTIFY_CONTENT_OPTIONS = [JUSTIFY_CONTENT_DEFAULT, *JUSTIFY_CONTENT_MAPPINGS.keys].freeze
14
18
 
15
19
  ALIGN_ITEMS_DEFAULT = nil
16
20
  ALIGN_ITEMS_MAPPINGS = {
@@ -18,19 +22,53 @@ module Primer
18
22
  end: "flex-items-end",
19
23
  center: "flex-items-center",
20
24
  baseline: "flex-items-baseline",
21
- stretch: "flex-items-stretch",
22
- }
23
- ALIGN_ITEMS_OPTIONS = [ALIGN_ITEMS_DEFAULT, *ALIGN_ITEMS_MAPPINGS.keys]
25
+ stretch: "flex-items-stretch"
26
+ }.freeze
27
+ ALIGN_ITEMS_OPTIONS = [ALIGN_ITEMS_DEFAULT, *ALIGN_ITEMS_MAPPINGS.keys].freeze
24
28
 
25
29
  INLINE_DEFAULT = false
26
- INLINE_OPTIONS = [INLINE_DEFAULT, true]
30
+ INLINE_OPTIONS = [INLINE_DEFAULT, true].freeze
27
31
 
28
32
  FLEX_WRAP_DEFAULT = nil
29
- FLEX_WRAP_OPTIONS = [FLEX_WRAP_DEFAULT, true, false]
33
+ FLEX_WRAP_OPTIONS = [FLEX_WRAP_DEFAULT, true, false].freeze
30
34
 
31
35
  DEFAULT_DIRECTION = nil
32
- ALLOWED_DIRECTIONS = [DEFAULT_DIRECTION, :column, :column_reverse, :row, :row_reverse]
36
+ ALLOWED_DIRECTIONS = [DEFAULT_DIRECTION, :column, :column_reverse, :row, :row_reverse].freeze
33
37
 
38
+ # @example auto|Default
39
+ # <%= render(Primer::FlexComponent.new(bg: :gray)) do %>
40
+ # <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 1" } %>
41
+ # <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 2" } %>
42
+ # <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 3" } %>
43
+ # <% end %>
44
+ #
45
+ # @example auto|Justify center
46
+ # <%= render(Primer::FlexComponent.new(justify_content: :center, bg: :gray)) do %>
47
+ # <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 1" } %>
48
+ # <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 2" } %>
49
+ # <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 3" } %>
50
+ # <% end %>
51
+ #
52
+ # @example auto|Align end
53
+ # <%= render(Primer::FlexComponent.new(align_items: :end, bg: :gray)) do %>
54
+ # <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 1" } %>
55
+ # <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 2" } %>
56
+ # <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 3" } %>
57
+ # <% end %>
58
+ #
59
+ # @example auto|Direction column
60
+ # <%= render(Primer::FlexComponent.new(direction: :column, bg: :gray)) do %>
61
+ # <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 1" } %>
62
+ # <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 2" } %>
63
+ # <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 3" } %>
64
+ # <% end %>
65
+ #
66
+ # @param justify_content [Symbol] Use this param to distribute space between and around flex items along the main axis of the container. <%= one_of(Primer::FlexComponent::JUSTIFY_CONTENT_OPTIONS) %>
67
+ # @param inline [Boolean] Defaults to false.
68
+ # @param flex_wrap [Boolean] Defaults to nil.
69
+ # @param align_items [Symbol] Use this param to align items on the cross axis. <%= one_of(Primer::FlexComponent::ALIGN_ITEMS_OPTIONS) %>
70
+ # @param direction [Symbol] Use this param to define the orientation of the main axis (row or column). By default, flex items will display in a row. <%= one_of(Primer::FlexComponent::ALLOWED_DIRECTIONS) %>
71
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
34
72
  def initialize(
35
73
  justify_content: JUSTIFY_CONTENT_DEFAULT,
36
74
  inline: INLINE_DEFAULT,
@@ -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 auto|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,14 @@
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
+ # @example auto|Default
7
+ # <%= render(Primer::HeadingComponent.new) { "H1 Text" } %>
8
+ # <%= render(Primer::HeadingComponent.new(tag: :h2)) { "H2 Text" } %>
9
+ # <%= render(Primer::HeadingComponent.new(tag: :h3)) { "H3 Text" } %>
10
+ #
11
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
5
12
  def initialize(**system_arguments)
6
13
  @system_arguments = system_arguments
7
14
  @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 auto|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 auto|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 auto|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 auto|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 auto|Default
7
7
  # <%= render(Primer::LinkComponent.new(href: "http://www.google.com")) { "Link" } %>
8
8
  #
9
- # @example 40|Muted
9
+ # @example auto|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
@@ -18,12 +18,16 @@ module Primer
18
18
  @system_arguments[:href] = href
19
19
  @system_arguments[:classes] = class_names(
20
20
  @system_arguments[:classes],
21
- "muted-link" => fetch_or_fallback([true, false], muted, false)
21
+ "muted-link" => fetch_or_fallback_boolean(muted, false)
22
22
  )
23
23
  end
24
24
 
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 5320|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