primer_view_components 0.0.7 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +72 -31
  3. data/README.md +2 -157
  4. data/app/components/primer/avatar_component.rb +11 -0
  5. data/app/components/primer/base_component.rb +7 -12
  6. data/app/components/primer/blankslate_component.html.erb +8 -2
  7. data/app/components/primer/blankslate_component.rb +70 -118
  8. data/app/components/primer/border_box_component.rb +16 -4
  9. data/app/components/primer/box_component.rb +2 -0
  10. data/app/components/primer/breadcrumb_component.rb +13 -20
  11. data/app/components/primer/button_component.rb +21 -4
  12. data/app/components/primer/component.rb +1 -0
  13. data/app/components/primer/counter_component.rb +5 -0
  14. data/app/components/primer/details_component.rb +4 -4
  15. data/app/components/primer/flash_component.html.erb +14 -0
  16. data/app/components/primer/flash_component.rb +73 -0
  17. data/app/components/primer/label_component.rb +17 -0
  18. data/app/components/primer/layout_component.rb +18 -1
  19. data/app/components/primer/link_component.rb +10 -0
  20. data/app/components/primer/octicon_component.rb +45 -0
  21. data/app/components/primer/popover_component.rb +38 -0
  22. data/app/components/primer/progress_bar_component.rb +29 -19
  23. data/app/components/primer/slot.rb +1 -0
  24. data/app/components/primer/spinner_component.html.erb +6 -0
  25. data/app/components/primer/spinner_component.rb +39 -0
  26. data/app/components/primer/state_component.rb +19 -7
  27. data/app/components/primer/subhead_component.rb +45 -20
  28. data/app/components/primer/text_component.rb +6 -0
  29. data/app/components/primer/timeline_item_component.rb +24 -0
  30. data/app/components/primer/view_components.rb +3 -0
  31. data/lib/primer/classify.rb +4 -0
  32. data/lib/primer/view_components/version.rb +1 -1
  33. metadata +21 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e2de200019cce82f6ab8da4f177fffa54cf62f703bca353b05376c9c7cb62ab
4
- data.tar.gz: 9166cc8d3208cbaee4e9c0ae12cca3c5b53faa56d081fd4baa28f79b0d48f1fa
3
+ metadata.gz: c05ad651f3b5b7815ccb7f623f098b488019c938c11b1d00ee93e467ec535b55
4
+ data.tar.gz: aafd79851c5e551d193d5282536806a1446ada7e12d1d25ba29437e58d7b1212
5
5
  SHA512:
6
- metadata.gz: deb5e962d169066fe55d7c28f9c81f7d5e59f5e13ee57dd33dfc80b0f37422c60feabb850ec4c6c02253ad3cace554a0146f74ed1287e075560ee39453e2f1f3
7
- data.tar.gz: e15db34d645de8e42bb29136d95c2caf87c61e4c2c84f09bbbe9a4f11ed48a99478c1f06b0fc7bf165806a74b30e6ff15fcaf1439b3bebee290765759cd3f0b5
6
+ metadata.gz: 30d274cb5271343b460ca8bfc1dc08317eff24ef71213633537acedf34eca63ffcb58a1581b5a95a678d5b88d1ec5229467c5b96dc7c3f2fa7aa918ce45b8426
7
+ data.tar.gz: 7806725e6845939d302bde336a73a89a1b1918e878a6b15666b157e2d8b4ce53535d630e2960d1077cc8bb7ba7867a60eadfd346ecda15fabce07aaacaabbb3d
@@ -1,10 +1,52 @@
1
- # 0.0.7
1
+ # CHANGELOG
2
+
3
+ ## main
4
+
5
+ ## 0.0.12
6
+
7
+ * Adds support for disabling inline box-sizing style for `SpinnerComponent` via style parameter `Primer::SpinnerComponent.new(style: nil)`.
8
+
9
+ *Chris Wilson*
10
+
11
+ ## 0.0.11
12
+
13
+ * Renames DetailsComponent::OVERLAY_DEFAULT to DetailsComponent::NO_OVERLAY to more correctly describe its value.
14
+
15
+ *Justin Kenyon*
16
+
17
+ ## 0.0.10
18
+
19
+ * Add SpinnerComponent
20
+
21
+ *Cole Bemis*
22
+
23
+ ## 0.0.9
24
+
25
+ * BREAKING CHANGE: OcticonComponent no longer accepts `class` parameter; use `classes` instead.
26
+
27
+ *heynan0*
28
+
29
+ ## 0.0.8
30
+
31
+ * Add support for border margins, such as: `border_top: 0`.
32
+
33
+ *Natasha Umer*
34
+
35
+ * Add FlashComponent and OcticonComponent.
36
+
37
+ *Joel Hawksley*
38
+
39
+ * BREAKING CHANGE: BlankslateComponent accepts `icon_size` instead of `icon_height`.
40
+
41
+ *Joel Hawksley*
42
+
43
+ ## 0.0.7
2
44
 
3
45
  * Use `octicons_helper` v11.0.0.
4
46
 
5
47
  *Joel Hawksley*
6
48
 
7
- # 0.0.6
49
+ ## 0.0.6
8
50
 
9
51
  * Updated the invalid class name error message
10
52
 
@@ -22,21 +64,19 @@
22
64
 
23
65
  *Manuel Puyol*
24
66
 
25
- ## Breaking changes
26
-
27
- * Changed `DetailsComponent` summary and body to be slots
67
+ * BREAKING CHANGE: Changed `DetailsComponent` summary and body to be slots
28
68
 
29
69
  *Manuel Puyol*
30
70
 
31
- # 0.0.5
71
+ ## 0.0.5
32
72
 
33
73
  * Add support for box_shadow
34
74
  * Add components:
35
- * Popover
75
+ * Popover
36
76
 
37
77
  *Sarah Vessels*
38
78
 
39
- # 0.0.4
79
+ ## 0.0.4
40
80
 
41
81
  * Added support for mx: and my: :auto.
42
82
 
@@ -45,19 +85,20 @@
45
85
  * Added support for custom layout sizes.
46
86
 
47
87
  *Manuel Puyol*
48
- # 0.0.3
88
+
89
+ ## 0.0.3
49
90
 
50
91
  * Add support for responsive `float` style argument.
51
92
 
52
93
  *Joel Hawksley*
53
94
 
54
95
  * Add components:
55
- * Avatar
56
- * Blankslate
96
+ * Avatar
97
+ * Blankslate
57
98
 
58
99
  *Manuel Puyol, Ben Emdon*
59
100
 
60
- # 0.0.1
101
+ ## 0.0.1
61
102
 
62
103
  * Add initial gem configuration.
63
104
 
@@ -72,24 +113,24 @@
72
113
  *Manuel Puyol*
73
114
 
74
115
  * Add components:
75
- * BorderBox
76
- * Box
77
- * Breadcrumb
78
- * Button
79
- * Counter
80
- * Details
81
- * Dropdown
82
- * Flex
83
- * FlexItem
84
- * Heading
85
- * Label
86
- * Layout
87
- * Link
88
- * ProgressBar
89
- * State
90
- * Subhead
91
- * Text
92
- * TimelineItem
93
- * UnderlineNav
116
+ * BorderBox
117
+ * Box
118
+ * Breadcrumb
119
+ * Button
120
+ * Counter
121
+ * Details
122
+ * Dropdown
123
+ * Flex
124
+ * FlexItem
125
+ * Heading
126
+ * Label
127
+ * Layout
128
+ * Link
129
+ * ProgressBar
130
+ * State
131
+ * Subhead
132
+ * Text
133
+ * TimelineItem
134
+ * UnderlineNav
94
135
 
95
136
  *Manuel Puyol*
data/README.md CHANGED
@@ -8,164 +8,9 @@
8
8
 
9
9
  _Note: This library is in pre-release development and should not be considered stable._
10
10
 
11
- ## Design philosophy
11
+ ## Documentation
12
12
 
13
- Primer ViewComponents aims to mimic the API of [Primer Components](https://github.com/primer/components), while using [Primer CSS](https://github.com/primer/css) under the hood.
14
-
15
- ## Installation
16
-
17
- In `Gemfile`, add:
18
-
19
- ```ruby
20
- gem "primer_view_components"
21
- ```
22
-
23
- In `config/application.rb`, add **after the application definition**
24
-
25
- ```ruby
26
- require "primer/view_components/engine"
27
- ```
28
-
29
- ## Usage
30
-
31
- ### Built-in styling arguments
32
-
33
- Primer components should be styled using the built-in arguments when possible. Most Primer utility classes for spacing, alignment, display, and colors have equivalent component arguments.
34
-
35
- Example label built with Primer CSS:
36
-
37
- ```html
38
- <span title="Label: Suggested" class="Label Label--outline Label--outline-green ml-2 v-align-middle">Suggested</span>
39
- ```
40
-
41
- The same label using `Primer::LabelComponent`:
42
-
43
- ```erb
44
- <%= render Primer::LabelComponent.new(ml: 2, vertical_align: :middle, scheme: :green, title: "Label: Suggested") do %>
45
- Suggested
46
- <% end %>
47
- ```
48
-
49
- Some components have their own specific arguments, but they can all be styled with the following arguments.
50
-
51
- | Component argument | Primer class | Example |
52
- | --------------- | --------------- | -------- |
53
- | `m` | `m-<value>` | `m: 4` → `.m-4` |
54
- | `my` | `my-<value>` | `my: 4` → `.my-4` |
55
- | `mx` | `my-<value>` | `mx: 4` → `.mx-4` |
56
- | `mt` | `mt-<value>` | `mt: 4` → `.mt-4` |
57
- | `mb` | `mb-<value>` | `mb: 4` → `.mb-4` |
58
- | `ml` | `ml-<value>` | `ml: 4` → `.ml-4` |
59
- | `mr` | `mr-<value>` | `mr: 4` → `.mr-4` |
60
- | `p` | `p-<value>` | `p: 4` → `.p-4` |
61
- | `py` | `py-<value>` | `py: 4` → `.py-4` |
62
- | `px` | `py-<value>` | `px: 4` → `.px-4` |
63
- | `pt` | `pt-<value>` | `pt: 4` → `.pt-4` |
64
- | `pb` | `pb-<value>` | `pb: 4` → `.pb-4` |
65
- | `pl` | `pl-<value>` | `pl: 4` → `.pl-4` |
66
- | `pr` | `pr-<value>` | `pr: 4` → `.pr-4` |
67
- | `pr` | `pr-<value>` | `pr: 4` → `.pr-4` |
68
- | `f` | `f-<value>` | `f: 4` → `.f-4` |
69
- | `color` | `color-<value>` | `color: :red_500` → `.color-red-500` |
70
- | `text` | `text-<value>` | `text: :green` → `.text-green` |
71
- | `bg` | `bg-<value>` | `bg: :blue_light` → `.bg-blue-light` |
72
- | `display` | `d-<value>` | `display: :none` → `.d-none` |
73
- | `float` | `float-<value>` | `float: :right` → `.float-right` |
74
- | `vertical_align` | `v-align-<value>` | `vertical_align: :baseline` → `.v-align-baseline` |
75
- | `text_align` | `text-<value>` | `text_align: :right` → `.text-right` |
76
- | `font_size` | `f<value>` | `font_size: 4` → `.f4` |
77
- | `font_weight` | `text-<value>` | `font_weight: :bold` → `.text-bold` |
78
- | `border` | `border-<value>` | `border: :bottom` → `.border-bottom` |
79
- | `border_color` | `border-<value>` | `border: :green` → `.border-green` |
80
- | `word_break` | `wb-<value>` | `word_break: :break_all` → `.wb-break-all` |
81
- | `direction` | `flex-<value>` | `direction: :row` → `.flex-row` |
82
- | `justify_content` | `flex-justify-<value>` | `justify_content: :center` → `.flex-justify-center` |
83
- | `align_items` | `flex-items-<value>` | `align_items: :baseline` → `.flex-items-baseline` |
84
- | `box_shadow` | `box-shadow-<value>` | `box_shadow: :medium` → `.box-shadow-medium` |
85
-
86
- #### Boolean arguments
87
- | Component arguments | True | False |
88
- | -------------- | ------- | ------ |
89
- | `underline` | `underline: true` → `.text-underline` | `underline: false` → `.no-underline` |
90
- | `top` | n/a | `top: false` → `.top-0` |
91
- | `bottom` | n/a | `bottom: false` → `.bottom-0` |
92
- | `left` | n/a | `left: false` → `.left-0` |
93
- | `right` | n/a | `right: false` → `.right-0` |
94
-
95
- #### Responsive arguments
96
-
97
- Different classes can be used for different breakpoints just like in Primer CSS. Simply use an array with the four values required for `[none, small, medium, large]`. If no breakpoint is needed for a breakpoint, pass `nil`.
98
-
99
- Example heading built with Primer CSS:
100
-
101
- ```html
102
- <h1 class="mt-0 mt-lg-4">Hello world</h1>
103
- ```
104
-
105
- The same label using `Primer::HeadingComponent`:
106
-
107
- ```erb
108
- <%= render Primer::HeadingComponent.new(mt: [0, nil, nil, 4]) do %>
109
- Hello world
110
- <% end %>
111
- ```
112
-
113
- ## Contributing
114
-
115
- Bug reports and pull requests are welcome on GitHub at https://github.com/primer/view_components. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
116
-
117
- ### Setting up
118
-
119
- Run
120
-
121
- ```bash
122
- script/setup
123
- ```
124
-
125
- to install all necessary dependencies
126
-
127
-
128
- ### Running tests
129
-
130
- To run the full test suite:
131
-
132
- ```bash
133
- bundle exec rake
134
- ```
135
-
136
- ### Storybook
137
-
138
- *We recommend having [overmind](https://github.com/DarthSim/overmind) installed to run both rails and storybook, but it is not required.*
139
-
140
- To run storybook:
141
-
142
- ```bash
143
- script/storybook
144
- ```
145
-
146
- ### Developing with another app
147
-
148
- In your `Gemfile`, change:
149
-
150
- ```ruby
151
- gem "primer_view_components"
152
- ```
153
-
154
- to
155
-
156
- ```ruby
157
- gem "primer_view_components", path: "path_to_the_gem" # e.g. path: "~/primer/view_components"
158
- ```
159
-
160
- Then, `bundle install` to update references. You'll now be able to see changes from the gem without having to build it.
161
- Remember that restarting the Rails server is necessary to see changes, as the gem is loaded at boot time.
162
-
163
- To minimize the number of restarts, we recommend checking the component in Storybook first, and then when it's in a good state,
164
- you can check it in your app.
165
-
166
- ### Documentation
167
-
168
- Document components with [YARD](https://yardoc.org/). Docs are published to [RubyDoc.info](https://rubydoc.info/github/primer/view_components).
13
+ Visit [https://primer.style/view-components/](https://primer.style/view-components//) to view documentation.
169
14
 
170
15
  ## License
171
16
 
@@ -1,9 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Primer
4
+ # Avatars are images used to represent users and organizations on GitHub.
5
+ # Use the default round avatar for users, and the `square` argument
6
+ # for organizations or any other non-human avatars.
4
7
  class AvatarComponent < Primer::Component
5
8
  SMALL_THRESHOLD = 24
6
9
 
10
+ #
11
+ # @example 34|Default
12
+ # <%= render(Primer::AvatarComponent.new(src: "http://placekitten.com/200/200", alt: "@kittenuser")) %>
13
+ #
14
+ # @param src [String] The source url of the avatar image
15
+ # @param alt [String] Passed through to alt on img tag
16
+ # @param size [Integer] Adds the avatar-small class if less than 24
17
+ # @param square [Boolean] Used to create a square avatar.
7
18
  def initialize(src:, alt:, size: 20, square: false, **kwargs)
8
19
  @kwargs = kwargs
9
20
  @kwargs[:tag] = :img
@@ -2,18 +2,15 @@
2
2
 
3
3
  module Primer
4
4
  # Base component used by other Primer components.
5
- #
6
- # tag(symbol): HTML tag name to be passed to tag.send(tag)
7
- # class_names(string): CSS class name value to be concatenated with generated Primer CSS classes
8
- # args(hash): Combination of arguments for classes_from_hash and content_tag
9
- #
10
- # Example usage:
11
- # <%= render Primer::BaseComponent, tag: :a, href: "http://www.google.com", mt: 4 do %>Link<% end %>
12
- # generates:
13
- # <a href="http://www.google.com" class="mt-4">Link</a>
14
5
  class BaseComponent < Primer::Component
15
6
  TEST_SELECTOR_TAG = :test_selector
16
7
 
8
+ #
9
+ # @example 34|Default
10
+ # <%= render(Primer::BaseComponent.new(tag: :a, href: "http://www.google.com", mt: 4)) { "Link" } %>
11
+ #
12
+ # @param tag [Symbol] HTML tag name to be passed to tag.send(tag)
13
+ # @param classes [String] CSS class name value to be concatenated with generated Primer CSS classes
17
14
  def initialize(tag:, classes: nil, **args)
18
15
  @tag = tag
19
16
  @result = Primer::Classify.call(**args.merge(classes: classes))
@@ -23,9 +20,7 @@ module Primer
23
20
  end
24
21
 
25
22
  def call
26
- tag.public_send(
27
- @tag, content, **@content_tag_args.merge(@result)
28
- )
23
+ content_tag(@tag, content, **@content_tag_args.merge(@result))
29
24
  end
30
25
 
31
26
  private
@@ -1,13 +1,19 @@
1
1
  <%= render Primer::BaseComponent.new(**@kwargs) do %>
2
2
  <% if @icon.present? %>
3
- <%= octicon @icon, height: @icon_height, class: "blankslate-icon" %>
3
+ <%= render(Primer::OcticonComponent.new(
4
+ icon: @icon,
5
+ size: @icon_size,
6
+ classes: "blankslate-icon"
7
+ )) %>
4
8
  <% end %>
5
9
 
6
10
  <% if @image_src.present? && @image_alt.present? %>
7
11
  <%= image_tag "#{@image_src}", class: "mb-3", size: "56x56", alt: "#{@image_alt}" %>
8
12
  <% end %>
9
13
 
10
- <<%= @title_tag %> class="mb-1"><%= @title %></<%= @title_tag %>>
14
+ <% if @title.present? %>
15
+ <%= render Primer::BaseComponent.new(tag: @title_tag, mb: 1) do %><%= @title %><% end %>
16
+ <% end %>
11
17
 
12
18
  <% if @description.present? %>
13
19
  <p><%= @description %></p>
@@ -1,126 +1,78 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Primer
4
- # Blankslates are for when there is a lack of content within a page or section. Use them as placeholders to tell users why something isn't there.
5
- #
6
- # ## Basic example
7
- #
8
- # The `Primer::BlankslateComponent` supports the following arguments to add a basic blankslate:
9
- #
10
- # 1. `title` (`String` required). Text that appears in a larger bold font.
11
- # 2. `description` (`String` optional). Text that appears below the title. Typically a whole sentence.
12
- #
13
- # ```ruby
14
- # <%= render Primer::BlankslateComponent.new(
15
- # title: "Title",
16
- # description: "Description",
17
- # ) %>
18
- # ```
19
- #
20
- # ## Icon or graphic (optional)
21
- #
22
- # Add an `icon` to give additional context. Please refer to the [Octicons](https://primer.style/octicons/) documentation to choose an icon.
23
- #
24
- # ```ruby
25
- # <%= render Primer::BlankslateComponent.new(
26
- # icon: "octoface",
27
- # title: "Title",
28
- # description: "Description",
29
- # ) %>
30
- # ```
31
- #
32
- # Alternatively you can also add a graphic by providing a path (`image_src`) to an image instead.Also, make sure to add an alternative description (`image_alt`). It will be used for the `alt` tag.
33
- #
34
- # ```ruby
35
- # <%= render Primer::BlankslateComponent.new(
36
- # image_src: "file.svg",
37
- # image_alt: "Description of the image",
38
- # title: "Title",
39
- # description: "Description",
40
- # ) %>
41
- # ```
42
- #
43
- # Both icon and graphic will appear above the title.
44
- #
45
- #
46
- # ## Custom content (optional)
47
- #
48
- # You can add any custom content that typically is used instead of the description:
49
- #
50
- # ```ruby
51
- # <%= render Primer::BlankslateComponent.new(
52
- # icon: "octoface",
53
- # title: "Title",
54
- # ) do %>
55
- # <p>Your custom content here</p>
56
- # <% end %>
57
- # ```
58
- #
59
- # ## Action button (optional)
60
- #
61
- # You can provide an action button to help users replace the blankslate. The button will appear below the description and custom content. It takes the following arguments:
62
- #
63
- # - `button_text` (`String` optional). The text of the button.
64
- # - `button_url` (`String` optional). The URL where the user will be taken after clicking the button.
65
- #
66
- # ```ruby
67
- # <%= render Primer::BlankslateComponent.new(
68
- # icon: "book",
69
- # title: "Welcome to the mona wiki!",
70
- # description: "Wikis provide a place in your repository to lay out the roadmap of your project, show the current status, and document software better, together.",
71
- #
72
- # button_text: "Create the first page",
73
- # button_url: "https://github.com/monalisa/mona/wiki/_new",
74
- # ) %>
75
- # ```
76
- #
77
- # ## Link (optional)
78
- #
79
- # Add an additional link to help users learn more about a feature. The link will be shown at the very bottom:
80
- #
81
- # - `link_text` (`String` optional). The text of the link.
82
- # - `link_url` (`String` optional). The URL where the user will be taken after clicking the link.
83
- #
84
- # ```ruby
85
- # <%= render Primer::BlankslateComponent.new(
86
- # icon: "book",
87
- # title: "Welcome to the mona wiki!",
88
- # description: "Wikis provide a place in your repository to lay out the roadmap of your project, show the current status, and document software better, together.",
89
- # button_text: "Create the first page",
90
- # button_url: "https://github.com/monalisa/mona/wiki/_new",
91
- # link_text: "Learn more about wikis",
92
- # link_url: "https://docs.github.com/en/github/building-a-strong-community/about-wikis",
93
- # ) %>
94
- # ```
95
- #
96
- # ## Variations (optional)
97
- #
98
- # There are a few variations of how the Blankslate appears:
99
- #
100
- # - `narrow` (`Boolean` optional). Adds a maximum width.
101
- # - `large` (`Boolean` optional). Increaeses the font size.
102
- # - `spacious` (`Boolean` optional). Adds extra padding.
103
- #
104
- # ```ruby
105
- # <%= render Primer::BlankslateComponent.new(
106
- # icon: "book",
107
- # title: "Welcome to the mona wiki!",
108
- # description: "Wikis provide a place in your repository to lay out the roadmap of your project, show the current status, and document software better, together.",
109
- #
110
- # narrow: true,
111
- # large: true,
112
- # spacious: true,
113
- # ) %>
114
- # ```
4
+ # Use Primer::BlankslateComponent when there is a lack of content within a page or section. Use as placeholder to tell users why something isn't there.
115
5
  class BlankslateComponent < Primer::Component
6
+ #
7
+ # @example 150|Basic
8
+ # <%= render Primer::BlankslateComponent.new(
9
+ # title: "Title",
10
+ # description: "Description",
11
+ # ) %>
12
+ #
13
+ # @example 190|Icon|Add an `icon` to give additional context. Refer to the [Octicons](https://primer.style/octicons/) documentation to choose an icon.
14
+ # <%= render Primer::BlankslateComponent.new(
15
+ # icon: "octoface",
16
+ # title: "Title",
17
+ # description: "Description",
18
+ # ) %>
19
+ #
20
+ # @example 150|Custom content|Pass custom content as a block in place of `description`.
21
+ # <%= render Primer::BlankslateComponent.new(
22
+ # title: "Title",
23
+ # ) do %>
24
+ # <em>Your custom content here</em>
25
+ # <% end %>
26
+ #
27
+ # @example 270|Action button|Provide a button to guide users to take action from the blankslate. The button appears below the description and custom content.
28
+ # <%= render Primer::BlankslateComponent.new(
29
+ # icon: "book",
30
+ # title: "Welcome to the mona wiki!",
31
+ # description: "Wikis provide a place in your repository to lay out the roadmap of your project, show the current status, and document software better, together.",
32
+ #
33
+ # button_text: "Create the first page",
34
+ # button_url: "https://github.com/monalisa/mona/wiki/_new",
35
+ # ) %>
36
+ #
37
+ # @example 225|Link|Add an additional link to help users learn more about a feature. The link will be shown at the very bottom:
38
+ # <%= render Primer::BlankslateComponent.new(
39
+ # icon: "book",
40
+ # title: "Welcome to the mona wiki!",
41
+ # description: "Wikis provide a place in your repository to lay out the roadmap of your project, show the current status, and document software better, together.",
42
+ # link_text: "Learn more about wikis",
43
+ # link_url: "https://docs.github.com/en/github/building-a-strong-community/about-wikis",
44
+ # ) %>
45
+ #
46
+ # @example 340|Variations|There are a few variations of how the Blankslate appears: `narrow` adds a maximum width, `large` increases the font size, and `spacious` adds extra padding.
47
+ # <%= render Primer::BlankslateComponent.new(
48
+ # icon: "book",
49
+ # title: "Welcome to the mona wiki!",
50
+ # description: "Wikis provide a place in your repository to lay out the roadmap of your project, show the current status, and document software better, together.",
51
+ # narrow: true,
52
+ # large: true,
53
+ # spacious: true,
54
+ # ) %>
55
+ #
56
+ # @param title [String] Text that appears in a larger bold font.
57
+ # @param title_tag [Symbol] HTML tag to use for title.
58
+ # @param icon [String] Octicon icon to use at top of component.
59
+ # @param icon_size [Symbol] <%= one_of(Primer::OcticonComponent::SIZE_MAPPINGS.keys) %>
60
+ # @param image_src [String] Image to display.
61
+ # @param image_alt [String] Alt text for image.
62
+ # @param description [String] Text that appears below the title. Typically a whole sentence.
63
+ # @param button_text [String] The text of the button.
64
+ # @param button_url [String] The URL where the user will be taken after clicking the button.
65
+ # @param button_classes [String] Classes to apply to action button
66
+ # @param link_text [String] The text of the link.
67
+ # @param link_url [String] The URL where the user will be taken after clicking the link.
68
+ # @param narrow [Boolean] Adds a maximum width.
69
+ # @param large [Boolean] Increases the font size.
70
+ # @param spacious [Boolean] Adds extra padding.
116
71
  def initialize(
117
- # required
118
- title:,
119
-
120
- # optional
72
+ title: "",
121
73
  title_tag: :h3,
122
74
  icon: "",
123
- icon_height: 32,
75
+ icon_size: :medium,
124
76
  image_src: "",
125
77
  image_alt: " ",
126
78
  description: "",
@@ -138,7 +90,7 @@ module Primer
138
90
  **kwargs
139
91
  )
140
92
  @kwargs = kwargs
141
- @kwargs[:tag] = :div
93
+ @kwargs[:tag] ||= :div
142
94
  @kwargs[:classes] = class_names(
143
95
  @kwargs[:classes],
144
96
  "blankslate",
@@ -149,7 +101,7 @@ module Primer
149
101
 
150
102
  @title_tag = title_tag
151
103
  @icon = icon
152
- @icon_height = icon_height
104
+ @icon_size = icon_size
153
105
  @image_src = image_src
154
106
  @image_alt = image_alt
155
107
  @title = title