primer_view_components 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +38 -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 +3 -3
  7. data/app/components/primer/blankslate_component.rb +8 -8
  8. data/app/components/primer/border_box_component.rb +29 -17
  9. data/app/components/primer/box_component.rb +2 -2
  10. data/app/components/primer/breadcrumb_component.rb +1 -1
  11. data/app/components/primer/button_component.rb +2 -2
  12. data/app/components/primer/button_group_component.rb +4 -1
  13. data/app/components/primer/button_marketing_component.rb +2 -2
  14. data/app/components/primer/component.rb +5 -6
  15. data/app/components/primer/counter_component.rb +5 -1
  16. data/app/components/primer/dropdown/menu_component.html.erb +12 -0
  17. data/app/components/primer/dropdown/menu_component.rb +48 -0
  18. data/app/components/primer/dropdown_component.html.erb +9 -0
  19. data/app/components/primer/dropdown_component.rb +77 -0
  20. data/app/components/primer/dropdown_menu_component.rb +4 -0
  21. data/app/components/primer/flash_component.rb +10 -6
  22. data/app/components/primer/flex_component.rb +38 -1
  23. data/app/components/primer/flex_item_component.rb +15 -1
  24. data/app/components/primer/heading_component.rb +1 -1
  25. data/app/components/primer/label_component.rb +2 -2
  26. data/app/components/primer/layout_component.rb +2 -2
  27. data/app/components/primer/link_component.rb +6 -2
  28. data/app/components/primer/markdown_component.rb +293 -0
  29. data/app/components/primer/menu_component.html.erb +6 -0
  30. data/app/components/primer/menu_component.rb +71 -0
  31. data/app/components/primer/octicon_component.rb +7 -3
  32. data/app/components/primer/popover_component.rb +5 -5
  33. data/app/components/primer/progress_bar_component.rb +5 -5
  34. data/app/components/primer/spinner_component.rb +7 -3
  35. data/app/components/primer/state_component.rb +3 -3
  36. data/app/components/primer/subhead_component.rb +6 -6
  37. data/app/components/primer/text_component.rb +1 -1
  38. data/app/components/primer/timeline_item_component.rb +4 -4
  39. data/app/components/primer/tooltip_component.rb +5 -5
  40. data/app/components/primer/truncate_component.rb +4 -4
  41. data/app/components/primer/underline_nav_component.rb +2 -2
  42. data/app/components/primer/view_components.rb +4 -0
  43. data/lib/primer/classify.rb +22 -9
  44. data/lib/primer/classify/cache.rb +125 -0
  45. data/lib/primer/fetch_or_fallback_helper.rb +1 -1
  46. data/lib/primer/join_style_arguments_helper.rb +1 -1
  47. data/lib/primer/view_components.rb +32 -1
  48. data/lib/primer/view_components/engine.rb +1 -1
  49. data/lib/primer/view_components/version.rb +1 -1
  50. data/lib/yard/renders_many_handler.rb +19 -0
  51. data/lib/yard/renders_one_handler.rb +19 -0
  52. data/static/statuses.json +1 -0
  53. metadata +46 -5
@@ -10,15 +10,14 @@ module Primer
10
10
 
11
11
  # sourced from https://primer.style/doctocat/usage/front-matter#status
12
12
  STATUSES = {
13
- deprecated: :deprecated,
14
- review: :review,
15
- experimental: :experimental,
16
- new: :new,
17
- stable: :stable
13
+ alpha: :alpha,
14
+ beta: :beta,
15
+ stable: :stable,
16
+ deprecated: :deprecated
18
17
  }.freeze
19
18
 
20
19
  def self.status
21
- STATUSES[:experimental]
20
+ STATUSES[:alpha]
22
21
  end
23
22
  end
24
23
  end
@@ -11,7 +11,7 @@ module Primer
11
11
  }.freeze
12
12
 
13
13
  #
14
- # @example 34|Default
14
+ # @example auto|Default
15
15
  # <%= render(Primer::CounterComponent.new(count: 25)) %>
16
16
  #
17
17
  # @param count [Integer, Float::INFINITY, nil] The number to be displayed (e.x. # of issues, pull requests)
@@ -51,6 +51,10 @@ module Primer
51
51
  render(Primer::BaseComponent.new(**@system_arguments)) { value }
52
52
  end
53
53
 
54
+ def self.status
55
+ Primer::Component::STATUSES[:beta]
56
+ end
57
+
54
58
  private
55
59
 
56
60
  def title
@@ -0,0 +1,12 @@
1
+ <%= render Primer::BaseComponent.new(**@system_arguments) do %>
2
+ <% if @header.present? %>
3
+ <div class="dropdown-header">
4
+ <%= @header %>
5
+ </div>
6
+ <% end %>
7
+ <ul>
8
+ <% items.each do |item| %>
9
+ <%= item %>
10
+ <% end %>
11
+ </ul>
12
+ <% end %>
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Dropdown
5
+ # This component is part of `Primer::DropdownComponent` and should not be
6
+ # used as a standalone component.
7
+ class MenuComponent < Primer::Component
8
+ include ViewComponent::SlotableV2
9
+
10
+ SCHEME_DEFAULT = :default
11
+ SCHEME_MAPPINGS = {
12
+ SCHEME_DEFAULT => "",
13
+ :dark => "dropdown-menu-dark"
14
+ }.freeze
15
+
16
+ DIRECTION_DEFAULT = :se
17
+ DIRECTION_OPTIONS = [DIRECTION_DEFAULT, :sw, :w, :e, :ne, :s].freeze
18
+
19
+ renders_many :items, lambda { |divider: false, **system_arguments|
20
+ system_arguments[:tag] = :li
21
+ system_arguments[:role] = :none if divider
22
+ system_arguments[:classes] = class_names(
23
+ system_arguments[:classes],
24
+ "dropdown-item" => !divider,
25
+ "dropdown-divider" => divider
26
+ )
27
+
28
+ Primer::BaseComponent.new(**system_arguments)
29
+ }
30
+
31
+ def initialize(direction: DIRECTION_DEFAULT, scheme: SCHEME_DEFAULT, header: nil, **system_arguments)
32
+ @header = header
33
+ @direction = direction
34
+ @system_arguments = system_arguments
35
+
36
+ @system_arguments[:tag] = "details-menu"
37
+ @system_arguments[:role] = "menu"
38
+
39
+ @system_arguments[:classes] = class_names(
40
+ @system_arguments[:classes],
41
+ "dropdown-menu",
42
+ "dropdown-menu-#{fetch_or_fallback(DIRECTION_OPTIONS, direction, DIRECTION_DEFAULT)}",
43
+ SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_MAPPINGS.keys, scheme, SCHEME_DEFAULT)]
44
+ )
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,9 @@
1
+ <%= render(Primer::DetailsComponent.new(**@system_arguments)) do |c| %>
2
+ <% c.slot(:summary, classes: @summary_classes) do %>
3
+ <%= button %>
4
+ <% end %>
5
+
6
+ <% c.slot(:body) do %>
7
+ <%= menu %>
8
+ <% end %>
9
+ <% end %>
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "dropdown/menu_component"
4
+
5
+ module Primer
6
+ # Dropdowns are lightweight context menus for housing navigation and actions.
7
+ # They're great for instances where you don't need the full power (and code) of the select menu.
8
+ class DropdownComponent < Primer::Component
9
+ include ViewComponent::SlotableV2
10
+
11
+ # Required trigger for the dropdown. Only accepts a content.
12
+ # Its classes can be customized by the `summary_classes` param in the parent component
13
+ renders_one :button
14
+
15
+ # Required context menu for the dropdown
16
+ #
17
+ # @param direction [Symbol] <%= one_of(Primer::Dropdown::MenuComponent::DIRECTION_OPTIONS) %>
18
+ # @param scheme [Symbol] Pass :dark for dark mode theming
19
+ # @param header [String] Optional string to display as the header
20
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
21
+ renders_one :menu, Primer::Dropdown::MenuComponent
22
+
23
+ # @example 210|Default
24
+ # <div style="margin-bottom: 150px">
25
+ # <%= render(Primer::DropdownComponent.new) do |c| %>
26
+ # <% c.button do %>
27
+ # Dropdown
28
+ # <% end %>
29
+ #
30
+ # <%= c.menu(header: "Options") do |menu|
31
+ # menu.item { "Item 1" }
32
+ # menu.item { "Item 2" }
33
+ # menu.item(divider: true)
34
+ # menu.item { "Item 3" }
35
+ # menu.item { "Item 4" }
36
+ # end %>
37
+ # <% end %>
38
+ # </div>
39
+ #
40
+ # @example 210|With Direction
41
+ # <div style="margin-bottom: 150px" class="d-flex flex-justify-center">
42
+ # <%= render(Primer::DropdownComponent.new) do |c| %>
43
+ # <% c.button do %>
44
+ # Dropdown
45
+ # <% end %>
46
+ #
47
+ # <%= c.menu(header: "Options", direction: :s) do |menu|
48
+ # menu.item { "Item 1" }
49
+ # menu.item { "Item 2" }
50
+ # menu.item(divider: true)
51
+ # menu.item { "Item 3" }
52
+ # menu.item { "Item 4" }
53
+ # end %>
54
+ # <% end %>
55
+ # </div>
56
+ #
57
+ # @param overlay [Symbol] <%= one_of(Primer::DetailsComponent::OVERLAY_MAPPINGS.keys) %>
58
+ # @param reset [Boolean] Whether to hide the default caret on the button
59
+ # @param summary_classes [String] Custom classes to add to the button
60
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
61
+ def initialize(overlay: :default, reset: true, summary_classes: "", **system_arguments)
62
+ @system_arguments = system_arguments
63
+ @system_arguments[:overlay] = overlay
64
+ @system_arguments[:reset] = reset
65
+ @system_arguments[:position] = :relative
66
+ @system_arguments[:classes] = class_names(
67
+ @system_arguments[:classes],
68
+ "dropdown"
69
+ )
70
+ @summary_classes = summary_classes
71
+ end
72
+
73
+ def render?
74
+ button.present? && menu.present?
75
+ end
76
+ end
77
+ end
@@ -14,6 +14,10 @@ module Primer
14
14
  DIRECTION_DEFAULT = :se
15
15
  DIRECTION_OPTIONS = [DIRECTION_DEFAULT, :sw, :w, :e, :ne, :s].freeze
16
16
 
17
+ def self.status
18
+ STATUSES[:deprecated]
19
+ end
20
+
17
21
  # @example 200|With a header
18
22
  # <div style="margin-bottom: 150px">
19
23
  # <%= render(Primer::DetailsComponent.new(overlay: :default, reset: true, position: :relative)) do |c| %>
@@ -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,7 +57,11 @@ module Primer
57
57
  @system_arguments[:mb] ||= spacious ? 4 : nil
58
58
  end
59
59
 
60
- # :nodoc
60
+ def self.status
61
+ Primer::Component::STATUSES[:beta]
62
+ end
63
+
64
+ # :nodoc:
61
65
  class Actions < Primer::Slot
62
66
  attr_reader :system_arguments
63
67
 
@@ -1,7 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Primer
4
- # :nodoc
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).
5
8
  class FlexComponent < Primer::Component
6
9
  JUSTIFY_CONTENT_DEFAULT = nil
7
10
  JUSTIFY_CONTENT_MAPPINGS = {
@@ -32,6 +35,40 @@ module Primer
32
35
  DEFAULT_DIRECTION = nil
33
36
  ALLOWED_DIRECTIONS = [DEFAULT_DIRECTION, :column, :column_reverse, :row, :row_reverse].freeze
34
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 %>
35
72
  def initialize(
36
73
  justify_content: JUSTIFY_CONTENT_DEFAULT,
37
74
  inline: INLINE_DEFAULT,
@@ -1,11 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Primer
4
- # :nodoc
4
+ # Use FlexItemComponent to specify the ability of a flex item to alter its
5
+ # dimensions to fill available space
5
6
  class FlexItemComponent < Primer::Component
6
7
  FLEX_AUTO_DEFAULT = false
7
8
  FLEX_AUTO_ALLOWED_VALUES = [FLEX_AUTO_DEFAULT, true].freeze
8
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 %>
9
23
  def initialize(flex_auto: FLEX_AUTO_DEFAULT, **system_arguments)
10
24
  @system_arguments = system_arguments
11
25
  @system_arguments[:classes] =
@@ -3,7 +3,7 @@
3
3
  module Primer
4
4
  # Use the Heading component to wrap a component that will create a heading element
5
5
  class HeadingComponent < Primer::Component
6
- # @example 70|Default
6
+ # @example auto|Default
7
7
  # <%= render(Primer::HeadingComponent.new) { "H1 Text" } %>
8
8
  # <%= render(Primer::HeadingComponent.new(tag: :h2)) { "H2 Text" } %>
9
9
  # <%= render(Primer::HeadingComponent.new(tag: :h3)) { "H3 Text" } %>
@@ -35,7 +35,7 @@ module Primer
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
@@ -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 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