primer_view_components 0.0.20 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +82 -1
- data/app/assets/javascripts/primer_view_components.js +2 -0
- data/app/assets/javascripts/primer_view_components.js.map +1 -0
- data/app/components/primer/avatar_component.rb +7 -7
- data/app/components/primer/avatar_stack_component.rb +3 -3
- data/app/components/primer/base_component.rb +2 -2
- data/app/components/primer/blankslate_component.html.erb +3 -3
- data/app/components/primer/blankslate_component.rb +16 -24
- data/app/components/primer/border_box_component.html.erb +4 -18
- data/app/components/primer/border_box_component.rb +58 -67
- data/app/components/primer/box_component.rb +2 -2
- data/app/components/primer/breadcrumb_component.html.erb +1 -2
- data/app/components/primer/breadcrumb_component.rb +24 -13
- data/app/components/primer/button_component.rb +2 -2
- data/app/components/primer/button_group_component.rb +1 -1
- data/app/components/primer/button_marketing_component.rb +2 -2
- data/app/components/primer/component.rb +4 -0
- data/app/components/primer/counter_component.rb +1 -1
- data/app/components/primer/details_component.html.erb +2 -6
- data/app/components/primer/details_component.rb +22 -35
- data/app/components/primer/dropdown_component.html.erb +2 -2
- data/app/components/primer/dropdown_component.rb +4 -6
- data/app/components/primer/dropdown_menu_component.rb +4 -4
- data/app/components/primer/flash_component.html.erb +4 -7
- data/app/components/primer/flash_component.rb +16 -20
- data/app/components/primer/flex_component.rb +4 -4
- data/app/components/primer/flex_item_component.rb +1 -1
- data/app/components/primer/heading_component.rb +3 -1
- data/app/components/primer/label_component.rb +22 -26
- data/app/components/primer/layout_component.rb +2 -2
- data/app/components/primer/link_component.rb +2 -2
- data/app/components/primer/markdown_component.rb +8 -8
- data/app/components/primer/menu_component.rb +1 -1
- data/app/components/primer/octicon_component.rb +5 -3
- data/app/components/primer/popover_component.rb +3 -3
- data/app/components/primer/primer.js +1 -0
- data/app/components/primer/primer.ts +1 -0
- data/app/components/primer/progress_bar_component.html.erb +1 -1
- data/app/components/primer/progress_bar_component.rb +27 -31
- data/app/components/primer/spinner_component.rb +3 -3
- data/app/components/primer/state_component.rb +21 -10
- data/app/components/primer/subhead_component.html.erb +3 -15
- data/app/components/primer/subhead_component.rb +47 -59
- data/app/components/primer/tab_container_component.js +1 -0
- data/app/components/primer/tab_container_component.rb +41 -0
- data/app/components/primer/tab_container_component.ts +1 -0
- data/app/components/primer/tab_nav_component.html.erb +17 -0
- data/app/components/primer/tab_nav_component.rb +108 -0
- data/app/components/primer/text_component.rb +1 -1
- data/app/components/primer/timeline_item_component.html.erb +4 -16
- data/app/components/primer/timeline_item_component.rb +41 -52
- data/app/components/primer/tooltip_component.rb +5 -5
- data/app/components/primer/truncate_component.rb +4 -4
- data/app/components/primer/underline_nav_component.rb +2 -2
- data/{lib → app/lib}/primer/class_name_helper.rb +0 -0
- data/{lib → app/lib}/primer/classify.rb +0 -2
- data/{lib → app/lib}/primer/classify/cache.rb +0 -0
- data/{lib → app/lib}/primer/fetch_or_fallback_helper.rb +0 -0
- data/{lib → app/lib}/primer/join_style_arguments_helper.rb +0 -0
- data/app/lib/primer/view_helper.rb +22 -0
- data/app/lib/primer/view_helper/dsl.rb +34 -0
- data/lib/primer/view_components/engine.rb +10 -2
- data/lib/primer/view_components/version.rb +5 -1
- data/static/statuses.json +1 -1
- metadata +18 -8
- data/app/components/primer/view_components.rb +0 -60
@@ -3,10 +3,10 @@
|
|
3
3
|
module Primer
|
4
4
|
# A basic wrapper component for most layout related needs.
|
5
5
|
class BoxComponent < Primer::Component
|
6
|
-
# @example
|
6
|
+
# @example Default
|
7
7
|
# <%= render(Primer::BoxComponent.new) { "Your content here" } %>
|
8
8
|
#
|
9
|
-
# @example
|
9
|
+
# @example Color and padding
|
10
10
|
# <%= render(Primer::BoxComponent.new(bg: :gray, p: 3)) { "Hello world" } %>
|
11
11
|
#
|
12
12
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -1,8 +1,7 @@
|
|
1
1
|
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
|
2
2
|
<ol>
|
3
3
|
<% items.each do |item| %>
|
4
|
-
|
5
|
-
<%= render Primer::BaseComponent.new(**item.system_arguments) do %><%- if item.href.present? %><a href="<%= item.href %>"><%= item.content %></a><%- else %><%= item.content %><%- end %><%- end %>
|
4
|
+
<%= item %>
|
6
5
|
<% end %>
|
7
6
|
</ol>
|
8
7
|
<% end %>
|
@@ -3,15 +3,20 @@
|
|
3
3
|
module Primer
|
4
4
|
# Use breadcrumbs to display page hierarchy within a section of the site. All of the items in the breadcrumb "trail" are links except for the final item, which is a plain string indicating the current page.
|
5
5
|
class BreadcrumbComponent < Primer::Component
|
6
|
-
include ViewComponent::
|
6
|
+
include ViewComponent::SlotableV2
|
7
7
|
|
8
|
-
|
8
|
+
# _Note: if both `href` and `selected: true` are passed in, `href` will be ignored and the item will not be rendered as a link._
|
9
|
+
#
|
10
|
+
# @param href [String] The URL to link to.
|
11
|
+
# @param selected [Boolean] Whether or not the item is selected and not rendered as a link.
|
12
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
13
|
+
renders_many :items, "ItemComponent"
|
9
14
|
|
10
|
-
# @example
|
15
|
+
# @example Basic
|
11
16
|
# <%= render(Primer::BreadcrumbComponent.new) do |component| %>
|
12
|
-
# <% component.
|
13
|
-
# <% component.
|
14
|
-
# <% component.
|
17
|
+
# <% component.item(href: "/") do %>Home<% end %>
|
18
|
+
# <% component.item(href: "/about") do %>About<% end %>
|
19
|
+
# <% component.item(selected: true) do %>Team<% end %>
|
15
20
|
# <% end %>
|
16
21
|
#
|
17
22
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -25,13 +30,9 @@ module Primer
|
|
25
30
|
items.any?
|
26
31
|
end
|
27
32
|
|
28
|
-
#
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# @param href [String] The URL to link to.
|
33
|
-
# @param selected [Boolean] Whether or not the item is selected and not rendered as a link.
|
34
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
33
|
+
# This component is part of `Primer::BreadcrumbComponent` and should not be
|
34
|
+
# used as a standalone component.
|
35
|
+
class ItemComponent < Primer::Component
|
35
36
|
def initialize(href: nil, selected: false, **system_arguments)
|
36
37
|
@href = href
|
37
38
|
@system_arguments = system_arguments
|
@@ -41,6 +42,16 @@ module Primer
|
|
41
42
|
@system_arguments[:"aria-current"] = "page" if selected
|
42
43
|
@system_arguments[:classes] = "breadcrumb-item #{@system_arguments[:classes]}"
|
43
44
|
end
|
45
|
+
|
46
|
+
def call
|
47
|
+
render(Primer::BaseComponent.new(**@system_arguments)) do
|
48
|
+
if @href.present?
|
49
|
+
render(Primer::LinkComponent.new(href: @href)) { content }
|
50
|
+
else
|
51
|
+
content
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
44
55
|
end
|
45
56
|
end
|
46
57
|
end
|
@@ -26,13 +26,13 @@ module Primer
|
|
26
26
|
DEFAULT_TYPE = :button
|
27
27
|
TYPE_OPTIONS = [DEFAULT_TYPE, :reset, :submit].freeze
|
28
28
|
|
29
|
-
# @example
|
29
|
+
# @example Button types
|
30
30
|
# <%= render(Primer::ButtonComponent.new) { "Default" } %>
|
31
31
|
# <%= render(Primer::ButtonComponent.new(button_type: :primary)) { "Primary" } %>
|
32
32
|
# <%= render(Primer::ButtonComponent.new(button_type: :danger)) { "Danger" } %>
|
33
33
|
# <%= render(Primer::ButtonComponent.new(button_type: :outline)) { "Outline" } %>
|
34
34
|
#
|
35
|
-
# @example
|
35
|
+
# @example Variants
|
36
36
|
# <%= render(Primer::ButtonComponent.new(variant: :small)) { "Small" } %>
|
37
37
|
# <%= render(Primer::ButtonComponent.new(variant: :medium)) { "Medium" } %>
|
38
38
|
# <%= render(Primer::ButtonComponent.new(variant: :large)) { "Large" } %>
|
@@ -10,7 +10,7 @@ module Primer
|
|
10
10
|
# @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::ButtonComponent) %>.
|
11
11
|
renders_many :buttons, ->(**kwargs) { Primer::ButtonComponent.new(group_item: true, **kwargs) }
|
12
12
|
|
13
|
-
# @example
|
13
|
+
# @example Default
|
14
14
|
# <%= render(Primer::ButtonGroupComponent.new) do |component|
|
15
15
|
# component.button { "Default" }
|
16
16
|
# component.button(button_type: :primary) { "Primary" }
|
@@ -25,7 +25,7 @@ module Primer
|
|
25
25
|
DEFAULT_TYPE = :button
|
26
26
|
TYPE_OPTIONS = [DEFAULT_TYPE, :submit].freeze
|
27
27
|
|
28
|
-
# @example
|
28
|
+
# @example Button types
|
29
29
|
# <%= render(Primer::ButtonMarketingComponent.new(mr: 2)) { "Default" } %>
|
30
30
|
# <%= render(Primer::ButtonMarketingComponent.new(button_type: :primary, mr: 2)) { "Primary" } %>
|
31
31
|
# <%= render(Primer::ButtonMarketingComponent.new(button_type: :outline)) { "Outline" } %>
|
@@ -33,7 +33,7 @@ module Primer
|
|
33
33
|
# <%= render(Primer::ButtonMarketingComponent.new(button_type: :transparent)) { "Transparent" } %>
|
34
34
|
# </div>
|
35
35
|
#
|
36
|
-
# @example
|
36
|
+
# @example Sizes
|
37
37
|
# <%= render(Primer::ButtonMarketingComponent.new(mr: 2)) { "Default" } %>
|
38
38
|
# <%= render(Primer::ButtonMarketingComponent.new(variant: :large)) { "Large" } %>
|
39
39
|
#
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "octicons_helper/helper"
|
4
|
+
|
3
5
|
module Primer
|
4
6
|
# @private
|
5
7
|
class Component < ViewComponent::Base
|
@@ -7,6 +9,8 @@ module Primer
|
|
7
9
|
include FetchOrFallbackHelper
|
8
10
|
include OcticonsHelper
|
9
11
|
include JoinStyleArgumentsHelper
|
12
|
+
include ViewHelper::Dsl
|
13
|
+
include ViewHelper
|
10
14
|
|
11
15
|
# sourced from https://primer.style/doctocat/usage/front-matter#status
|
12
16
|
STATUSES = {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Primer
|
4
4
|
# Use DetailsComponent to reveal content after clicking a button.
|
5
5
|
class DetailsComponent < Primer::Component
|
6
|
-
include ViewComponent::
|
6
|
+
include ViewComponent::SlotableV2
|
7
7
|
|
8
8
|
NO_OVERLAY = :none
|
9
9
|
OVERLAY_MAPPINGS = {
|
@@ -12,8 +12,27 @@ module Primer
|
|
12
12
|
:dark => "details-overlay details-overlay-dark"
|
13
13
|
}.freeze
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
# Use the Summary slot as a trigger to reveal the content.
|
16
|
+
#
|
17
|
+
# @param button [Boolean] Whether to render the Summary as a button or not.
|
18
|
+
# @param kwargs [Hash] The same arguments as <%= link_to_system_arguments_docs %>.
|
19
|
+
renders_one :summary, lambda { |button = true, **system_arguments|
|
20
|
+
system_arguments = system_arguments
|
21
|
+
system_arguments[:tag] = :summary
|
22
|
+
system_arguments[:role] = "button"
|
23
|
+
|
24
|
+
Primer::BaseComponent.new(**system_arguments) unless button
|
25
|
+
|
26
|
+
Primer::ButtonComponent.new(**system_arguments)
|
27
|
+
}
|
28
|
+
|
29
|
+
# Use the Body slot as the main content to be shown when triggered by the Summary.
|
30
|
+
#
|
31
|
+
# @param kwargs [Hash] The same arguments as <%= link_to_system_arguments_docs %>.
|
32
|
+
renders_one :body, lambda { |**system_arguments|
|
33
|
+
system_arguments[:tag] ||= :div
|
34
|
+
Primer::BaseComponent.new(**system_arguments)
|
35
|
+
}
|
17
36
|
|
18
37
|
# @param overlay [Symbol] Dictates the type of overlay to render with. <%= one_of(Primer::DetailsComponent::OVERLAY_MAPPINGS.keys) %>
|
19
38
|
# @param reset [Boolean] Defatuls to false. If set to true, it will remove the default caret and remove style from the summary element
|
@@ -31,37 +50,5 @@ module Primer
|
|
31
50
|
def render?
|
32
51
|
summary.present? && body.present?
|
33
52
|
end
|
34
|
-
|
35
|
-
# Use the Summary slot as a trigger to reveal the content.
|
36
|
-
class Summary < Primer::Slot
|
37
|
-
# @param button [Boolean] Whether to render the Summary as a button or not.
|
38
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
39
|
-
def initialize(button: true, **system_arguments)
|
40
|
-
@button = button
|
41
|
-
|
42
|
-
@system_arguments = system_arguments
|
43
|
-
@system_arguments[:tag] = :summary
|
44
|
-
@system_arguments[:role] = "button"
|
45
|
-
end
|
46
|
-
|
47
|
-
def component
|
48
|
-
return Primer::BaseComponent.new(**@system_arguments) unless @button
|
49
|
-
|
50
|
-
Primer::ButtonComponent.new(**@system_arguments)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# Use the Body slot as the main content to be shown when triggered by the Summary.
|
55
|
-
class Body < Primer::Slot
|
56
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
57
|
-
def initialize(**system_arguments)
|
58
|
-
@system_arguments = system_arguments
|
59
|
-
@system_arguments[:tag] ||= :div
|
60
|
-
end
|
61
|
-
|
62
|
-
def component
|
63
|
-
Primer::BaseComponent.new(**@system_arguments)
|
64
|
-
end
|
65
|
-
end
|
66
53
|
end
|
67
54
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%= render(Primer::DetailsComponent.new(**@system_arguments)) do |c| %>
|
2
|
-
<% c.
|
2
|
+
<% c.summary(classes: @summary_classes) do %>
|
3
3
|
<%= button %>
|
4
4
|
<% end %>
|
5
5
|
|
6
|
-
<% c.
|
6
|
+
<% c.body do %>
|
7
7
|
<%= menu %>
|
8
8
|
<% end %>
|
9
9
|
<% end %>
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "dropdown/menu_component"
|
4
|
-
|
5
3
|
module Primer
|
6
4
|
# Dropdowns are lightweight context menus for housing navigation and actions.
|
7
5
|
# They're great for instances where you don't need the full power (and code) of the select menu.
|
@@ -20,8 +18,8 @@ module Primer
|
|
20
18
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
21
19
|
renders_one :menu, Primer::Dropdown::MenuComponent
|
22
20
|
|
23
|
-
# @example
|
24
|
-
# <div
|
21
|
+
# @example Default
|
22
|
+
# <div>
|
25
23
|
# <%= render(Primer::DropdownComponent.new) do |c| %>
|
26
24
|
# <% c.button do %>
|
27
25
|
# Dropdown
|
@@ -37,8 +35,8 @@ module Primer
|
|
37
35
|
# <% end %>
|
38
36
|
# </div>
|
39
37
|
#
|
40
|
-
# @example
|
41
|
-
# <div
|
38
|
+
# @example With Direction
|
39
|
+
# <div>
|
42
40
|
# <%= render(Primer::DropdownComponent.new) do |c| %>
|
43
41
|
# <% c.button do %>
|
44
42
|
# Dropdown
|
@@ -18,14 +18,14 @@ module Primer
|
|
18
18
|
STATUSES[:deprecated]
|
19
19
|
end
|
20
20
|
|
21
|
-
# @example
|
22
|
-
# <div
|
21
|
+
# @example With a header
|
22
|
+
# <div>
|
23
23
|
# <%= render(Primer::DetailsComponent.new(overlay: :default, reset: true, position: :relative)) do |c| %>
|
24
|
-
# <% c.
|
24
|
+
# <% c.summary do %>
|
25
25
|
# Dropdown
|
26
26
|
# <% end %>
|
27
27
|
#
|
28
|
-
# <% c.
|
28
|
+
# <% c.body do %>
|
29
29
|
# <%= render(Primer::DropdownMenuComponent.new(header: "Options")) do %>
|
30
30
|
# <ul>
|
31
31
|
# <li><a class="dropdown-item" href="#url">Dropdown item</a></li>
|
@@ -1,14 +1,11 @@
|
|
1
1
|
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
|
2
|
-
<%=
|
2
|
+
<%= primer(:octicon, icon: @icon) if @icon %>
|
3
3
|
<%= content %>
|
4
4
|
<% if @dismissible %>
|
5
5
|
<button class="flash-close js-flash-close" type="button" aria-label="Close">
|
6
|
-
<%=
|
6
|
+
<%= primer(:octicon, icon: "x") %>
|
7
7
|
</button>
|
8
8
|
<% end %>
|
9
|
-
|
10
|
-
|
11
|
-
<%= actions.content %>
|
12
|
-
<% end %>
|
13
|
-
<% end %>
|
9
|
+
|
10
|
+
<%= action %>
|
14
11
|
<% end %>
|
@@ -3,9 +3,17 @@
|
|
3
3
|
module Primer
|
4
4
|
# Use the Flash component to inform users of successful or pending actions.
|
5
5
|
class FlashComponent < Primer::Component
|
6
|
-
include ViewComponent::
|
6
|
+
include ViewComponent::SlotableV2
|
7
7
|
|
8
|
-
|
8
|
+
# Optional action content showed on the right side of the component.
|
9
|
+
#
|
10
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
11
|
+
renders_one :action, lambda { |**system_arguments|
|
12
|
+
system_arguments[:tag] = :div
|
13
|
+
system_arguments[:classes] = class_names(system_arguments[:classes], "flash-action")
|
14
|
+
|
15
|
+
Primer::BaseComponent.new(**system_arguments)
|
16
|
+
}
|
9
17
|
|
10
18
|
DEFAULT_VARIANT = :default
|
11
19
|
VARIANT_MAPPINGS = {
|
@@ -14,25 +22,25 @@ module Primer
|
|
14
22
|
:danger => "flash-error",
|
15
23
|
:success => "flash-success"
|
16
24
|
}.freeze
|
17
|
-
# @example
|
25
|
+
# @example Variants
|
18
26
|
# <%= render(Primer::FlashComponent.new) { "This is a flash message!" } %>
|
19
27
|
# <%= render(Primer::FlashComponent.new(variant: :warning)) { "This is a warning flash message!" } %>
|
20
28
|
# <%= render(Primer::FlashComponent.new(variant: :danger)) { "This is a danger flash message!" } %>
|
21
29
|
# <%= render(Primer::FlashComponent.new(variant: :success)) { "This is a success flash message!" } %>
|
22
30
|
#
|
23
|
-
# @example
|
31
|
+
# @example Full width
|
24
32
|
# <%= render(Primer::FlashComponent.new(full: true)) { "This is a full width flash message!" } %>
|
25
33
|
#
|
26
|
-
# @example
|
34
|
+
# @example Dismissible
|
27
35
|
# <%= render(Primer::FlashComponent.new(dismissible: true)) { "This is a dismissible flash message!" } %>
|
28
36
|
#
|
29
|
-
# @example
|
37
|
+
# @example Icon
|
30
38
|
# <%= render(Primer::FlashComponent.new(icon: "people")) { "This is a flash message with an icon!" } %>
|
31
39
|
#
|
32
|
-
# @example
|
40
|
+
# @example With actions
|
33
41
|
# <%= render(Primer::FlashComponent.new) do |component| %>
|
34
42
|
# This is a flash message with actions!
|
35
|
-
# <% component.
|
43
|
+
# <% component.action do %>
|
36
44
|
# <%= render(Primer::ButtonComponent.new(variant: :small)) { "Take action" } %>
|
37
45
|
# <% end %>
|
38
46
|
# <% end %>
|
@@ -60,17 +68,5 @@ module Primer
|
|
60
68
|
def self.status
|
61
69
|
Primer::Component::STATUSES[:beta]
|
62
70
|
end
|
63
|
-
|
64
|
-
# :nodoc:
|
65
|
-
class Actions < Primer::Slot
|
66
|
-
attr_reader :system_arguments
|
67
|
-
|
68
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
69
|
-
def initialize(**system_arguments)
|
70
|
-
@system_arguments = system_arguments
|
71
|
-
@system_arguments[:tag] = :div
|
72
|
-
@system_arguments[:classes] = class_names(@system_arguments[:classes], "flash-action")
|
73
|
-
end
|
74
|
-
end
|
75
71
|
end
|
76
72
|
end
|
@@ -35,28 +35,28 @@ module Primer
|
|
35
35
|
DEFAULT_DIRECTION = nil
|
36
36
|
ALLOWED_DIRECTIONS = [DEFAULT_DIRECTION, :column, :column_reverse, :row, :row_reverse].freeze
|
37
37
|
|
38
|
-
# @example
|
38
|
+
# @example Default
|
39
39
|
# <%= render(Primer::FlexComponent.new(bg: :gray)) do %>
|
40
40
|
# <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 1" } %>
|
41
41
|
# <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 2" } %>
|
42
42
|
# <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 3" } %>
|
43
43
|
# <% end %>
|
44
44
|
#
|
45
|
-
# @example
|
45
|
+
# @example Justify center
|
46
46
|
# <%= render(Primer::FlexComponent.new(justify_content: :center, bg: :gray)) do %>
|
47
47
|
# <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 1" } %>
|
48
48
|
# <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 2" } %>
|
49
49
|
# <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 3" } %>
|
50
50
|
# <% end %>
|
51
51
|
#
|
52
|
-
# @example
|
52
|
+
# @example Align end
|
53
53
|
# <%= render(Primer::FlexComponent.new(align_items: :end, bg: :gray)) do %>
|
54
54
|
# <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 1" } %>
|
55
55
|
# <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 2" } %>
|
56
56
|
# <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 3" } %>
|
57
57
|
# <% end %>
|
58
58
|
#
|
59
|
-
# @example
|
59
|
+
# @example Direction column
|
60
60
|
# <%= render(Primer::FlexComponent.new(direction: :column, bg: :gray)) do %>
|
61
61
|
# <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 1" } %>
|
62
62
|
# <%= render(Primer::BoxComponent.new(p: 5, bg: :gray_light, classes: "border")) { "Item 2" } %>
|
@@ -7,7 +7,7 @@ module Primer
|
|
7
7
|
FLEX_AUTO_DEFAULT = false
|
8
8
|
FLEX_AUTO_ALLOWED_VALUES = [FLEX_AUTO_DEFAULT, true].freeze
|
9
9
|
|
10
|
-
# @example
|
10
|
+
# @example Default
|
11
11
|
# <%= render(Primer::FlexComponent.new) do %>
|
12
12
|
# <%= render(Primer::FlexItemComponent.new) do %>
|
13
13
|
# Item 1
|
@@ -3,7 +3,9 @@
|
|
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
|
-
|
6
|
+
view_helper :heading
|
7
|
+
|
8
|
+
# @example Default
|
7
9
|
# <%= render(Primer::HeadingComponent.new) { "H1 Text" } %>
|
8
10
|
# <%= render(Primer::HeadingComponent.new(tag: :h2)) { "H2 Text" } %>
|
9
11
|
# <%= render(Primer::HeadingComponent.new(tag: :h3)) { "H3 Text" } %>
|