primer_view_components 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +46 -1
- data/README.md +135 -0
- data/app/components/primer/avatar_component.rb +28 -0
- data/app/components/primer/base_component.rb +42 -0
- data/app/components/primer/blankslate_component.html.erb +27 -0
- data/app/components/primer/blankslate_component.rb +156 -0
- data/app/components/primer/border_box_component.html.erb +26 -0
- data/app/components/primer/border_box_component.rb +77 -0
- data/app/components/primer/box_component.rb +14 -0
- data/app/components/primer/breadcrumb_component.html.erb +8 -0
- data/app/components/primer/breadcrumb_component.rb +52 -0
- data/app/components/primer/button_component.rb +58 -0
- data/app/components/primer/component.rb +9 -0
- data/app/components/primer/counter_component.rb +78 -0
- data/app/components/primer/details_component.html.erb +6 -0
- data/app/components/primer/details_component.rb +38 -0
- data/app/components/primer/dropdown_menu_component.html.erb +8 -0
- data/app/components/primer/dropdown_menu_component.rb +28 -0
- data/app/components/primer/flex_component.rb +81 -0
- data/app/components/primer/flex_item_component.rb +21 -0
- data/app/components/primer/heading_component.rb +14 -0
- data/app/components/primer/label_component.rb +48 -0
- data/app/components/primer/layout_component.html.erb +17 -0
- data/app/components/primer/layout_component.rb +21 -0
- data/app/components/primer/link_component.rb +19 -0
- data/app/components/primer/progress_bar_component.html.erb +5 -0
- data/app/components/primer/progress_bar_component.rb +66 -0
- data/app/components/primer/slot.rb +8 -0
- data/app/components/primer/state_component.rb +53 -0
- data/app/components/primer/subhead_component.html.erb +17 -0
- data/app/components/primer/subhead_component.rb +89 -0
- data/app/components/primer/text_component.rb +14 -0
- data/app/components/primer/timeline_item_component.html.erb +17 -0
- data/app/components/primer/timeline_item_component.rb +69 -0
- data/app/components/primer/underline_nav_component.html.erb +11 -0
- data/app/components/primer/underline_nav_component.rb +22 -0
- data/app/components/primer/view_components.rb +47 -0
- data/lib/primer/class_name_helper.rb +27 -0
- data/lib/primer/classify.rb +237 -0
- data/lib/primer/fetch_or_fallback_helper.rb +41 -0
- data/lib/primer/view_components.rb +3 -0
- data/lib/primer/view_components/engine.rb +11 -0
- data/lib/primer/view_components/version.rb +1 -1
- metadata +159 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adc437081b46691abf1c8946de200196e1ceb5b535aa47e7925c03495ae73f3d
|
4
|
+
data.tar.gz: fbbeda9a022db4a9799daf8c0b509481f0ef57c122ac50c51c487a50445a9d65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 648cb2d8145c520fdf7f3da6af9b4047954343d7311caa7b5579adab5dc67b9ca697815e0f0b9c0f9f8d702edd82f9948fbf14ae3ee9397175aa0f3a8d12ec0e
|
7
|
+
data.tar.gz: 90e55106cc699d69f4473cb2844687b4b77597b85c5038be41acf3f56575f0c7e8dbce27ec7fe407b80b91ee12345bc272d2442b84af8ebf837be4451f0983b8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,50 @@
|
|
1
1
|
# main
|
2
2
|
|
3
|
+
# 0.0.3
|
4
|
+
|
5
|
+
* Add support for responsive `float` style argument.
|
6
|
+
|
7
|
+
*Joel Hawksley*
|
8
|
+
|
9
|
+
* Add components:
|
10
|
+
* Avatar
|
11
|
+
* Blankslate
|
12
|
+
|
13
|
+
*Manuel Puyol, Ben Emdon*
|
14
|
+
|
15
|
+
# 0.0.1
|
16
|
+
|
3
17
|
* Add initial gem configuration.
|
4
18
|
|
5
|
-
*Manuel Puyol, Joel Hawksley*
|
19
|
+
*Manuel Puyol, Joel Hawksley*
|
20
|
+
|
21
|
+
* Add demo app and storybook to test
|
22
|
+
|
23
|
+
*Manuel Puyol*
|
24
|
+
|
25
|
+
* Add Classify, FetchOrFallback and ClassName helpers
|
26
|
+
|
27
|
+
*Manuel Puyol*
|
28
|
+
|
29
|
+
* Add components:
|
30
|
+
* BorderBox
|
31
|
+
* Box
|
32
|
+
* Breadcrumb
|
33
|
+
* Button
|
34
|
+
* Counter
|
35
|
+
* Details
|
36
|
+
* Dropdown
|
37
|
+
* Flex
|
38
|
+
* FlexItem
|
39
|
+
* Heading
|
40
|
+
* Label
|
41
|
+
* Layout
|
42
|
+
* Link
|
43
|
+
* ProgressBar
|
44
|
+
* State
|
45
|
+
* Subhead
|
46
|
+
* Text
|
47
|
+
* TimelineItem
|
48
|
+
* UnderlineNav
|
49
|
+
|
50
|
+
*Manuel Puyol*
|
data/README.md
CHANGED
@@ -6,6 +6,12 @@
|
|
6
6
|
|
7
7
|
<p align="center">ViewComponents for the Primer Design System</p>
|
8
8
|
|
9
|
+
_Note: This library is in pre-release development and should not be considered stable._
|
10
|
+
|
11
|
+
## Design philosophy
|
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
|
+
|
9
15
|
## Installation
|
10
16
|
|
11
17
|
In `Gemfile`, add:
|
@@ -14,10 +20,139 @@ In `Gemfile`, add:
|
|
14
20
|
gem "primer_view_components"
|
15
21
|
```
|
16
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
|
+
|
85
|
+
#### Boolean arguments
|
86
|
+
| Component arguments | True | False |
|
87
|
+
| -------------- | ------- | ------ |
|
88
|
+
| `underline` | `underline: true` → `.text-underline` | `underline: false` → `.no-underline` |
|
89
|
+
| `top` | n/a | `top: false` → `.top-0` |
|
90
|
+
| `bottom` | n/a | `bottom: false` → `.bottom-0` |
|
91
|
+
| `left` | n/a | `left: false` → `.left-0` |
|
92
|
+
| `right` | n/a | `right: false` → `.right-0` |
|
93
|
+
|
94
|
+
#### Responsive arguments
|
95
|
+
|
96
|
+
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`.
|
97
|
+
|
98
|
+
Example heading built with Primer CSS:
|
99
|
+
|
100
|
+
```html
|
101
|
+
<h1 class="mt-0 mt-lg-4">Hello world</h1>
|
102
|
+
```
|
103
|
+
|
104
|
+
The same label using `Primer::HeadingComponent`:
|
105
|
+
|
106
|
+
```erb
|
107
|
+
<%= render Primer::HeadingComponent.new(mt: [0, nil, nil, 4]) do %>
|
108
|
+
Hello world
|
109
|
+
<% end %>
|
110
|
+
```
|
111
|
+
|
17
112
|
## Contributing
|
18
113
|
|
19
114
|
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.
|
20
115
|
|
116
|
+
### Setting up
|
117
|
+
|
118
|
+
Run
|
119
|
+
|
120
|
+
```bash
|
121
|
+
script/setup
|
122
|
+
```
|
123
|
+
|
124
|
+
to install all necessary dependencies
|
125
|
+
|
126
|
+
### Storybook
|
127
|
+
|
128
|
+
*We recommend having [overmind](https://github.com/DarthSim/overmind) installed to run both rails and storybook, but it is not required.*
|
129
|
+
|
130
|
+
To run storybook:
|
131
|
+
|
132
|
+
```bash
|
133
|
+
script/storybook
|
134
|
+
```
|
135
|
+
|
136
|
+
### Developing with another app
|
137
|
+
|
138
|
+
In your `Gemfile`, change:
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
gem "primer_view_components"
|
142
|
+
```
|
143
|
+
|
144
|
+
to
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
gem "primer_view_components", path: "path_to_the_gem" # e.g. path: "~/primer/view_components"
|
148
|
+
```
|
149
|
+
|
150
|
+
Then, `bundle install` to update references. You'll now be able to see changes from the gem without having to build it.
|
151
|
+
Remember that restarting the Rails server is necessary to see changes, as the gem is loaded at boot time.
|
152
|
+
|
153
|
+
To minimize the number of restarts, we recommend checking the component in Storybook first, and then when it's in a good state,
|
154
|
+
you can check it in your app.
|
155
|
+
|
21
156
|
## License
|
22
157
|
|
23
158
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
class AvatarComponent < Primer::Component
|
5
|
+
SMALL_THRESHOLD = 24
|
6
|
+
|
7
|
+
def initialize(src:, alt:, size: 20, square: false, **kwargs)
|
8
|
+
@kwargs = kwargs
|
9
|
+
@kwargs[:tag] = :img
|
10
|
+
@kwargs[:src] = src
|
11
|
+
@kwargs[:alt] = alt
|
12
|
+
@kwargs[:size] = size
|
13
|
+
@kwargs[:height] = size
|
14
|
+
@kwargs[:width] = size
|
15
|
+
|
16
|
+
@kwargs[:classes] = class_names(
|
17
|
+
"avatar",
|
18
|
+
kwargs[:classes],
|
19
|
+
"avatar--small" => size < SMALL_THRESHOLD,
|
20
|
+
"CircleBadge" => !square
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def call
|
25
|
+
render(Primer::BaseComponent.new(**@kwargs)) { content }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
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
|
+
class BaseComponent < Primer::Component
|
15
|
+
TEST_SELECTOR_TAG = :test_selector
|
16
|
+
|
17
|
+
def initialize(tag:, classes: nil, **args)
|
18
|
+
@tag = tag
|
19
|
+
@result = Primer::Classify.call(**args.merge(classes: classes))
|
20
|
+
|
21
|
+
# Filter out Primer keys so they don't get assigned as HTML attributes
|
22
|
+
@content_tag_args = add_test_selector(args).except(*Primer::Classify::VALID_KEYS)
|
23
|
+
end
|
24
|
+
|
25
|
+
def call
|
26
|
+
tag.public_send(
|
27
|
+
@tag, content, **@content_tag_args.merge(@result)
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def add_test_selector(args)
|
34
|
+
if args.key?(TEST_SELECTOR_TAG) && !Rails.env.production?
|
35
|
+
args[:data] ||= {}
|
36
|
+
args[:data][TEST_SELECTOR_TAG] = args[TEST_SELECTOR_TAG]
|
37
|
+
end
|
38
|
+
|
39
|
+
args.except(TEST_SELECTOR_TAG)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= render Primer::BaseComponent.new(**@kwargs) do %>
|
2
|
+
<% if @icon.present? %>
|
3
|
+
<%= octicon @icon, height: @icon_height, class: "blankslate-icon" %>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<% if @image_src.present? && @image_alt.present? %>
|
7
|
+
<%= image_tag "#{@image_src}", class: "mb-3", size: "56x56", alt: "#{@image_alt}" %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<<%= @title_tag %> class="mb-1"><%= @title %></<%= @title_tag %>>
|
11
|
+
|
12
|
+
<% if @description.present? %>
|
13
|
+
<p><%= @description %></p>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= content %>
|
17
|
+
|
18
|
+
<% if @button_text.present? && @button_url.present? %>
|
19
|
+
<p><a class="btn <%= @button_classes %>" href="<%= @button_url %>"><%= @button_text %></a></p>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<% if @link_text.present? && @link_url.present? %>
|
23
|
+
<p class="mt-3">
|
24
|
+
<%= link_to "#{@link_url}" do %><%= @link_text %><% end %>
|
25
|
+
</p>
|
26
|
+
<% end %>
|
27
|
+
<% end %>
|
@@ -0,0 +1,156 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
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
|
+
#
|
102
|
+
# ```ruby
|
103
|
+
# <%= render Primer::BlankslateComponent.new(
|
104
|
+
# icon: "book",
|
105
|
+
# title: "Welcome to the mona wiki!",
|
106
|
+
# 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.",
|
107
|
+
#
|
108
|
+
# narrow: true,
|
109
|
+
# ) %>
|
110
|
+
# ```
|
111
|
+
class BlankslateComponent < Primer::Component
|
112
|
+
def initialize(
|
113
|
+
# required
|
114
|
+
title:,
|
115
|
+
|
116
|
+
# optional
|
117
|
+
title_tag: :h3,
|
118
|
+
icon: "",
|
119
|
+
icon_height: 32,
|
120
|
+
image_src: "",
|
121
|
+
image_alt: " ",
|
122
|
+
description: "",
|
123
|
+
button_text: "",
|
124
|
+
button_url: "",
|
125
|
+
button_classes: "btn-sm btn-primary",
|
126
|
+
link_text: "",
|
127
|
+
link_url: "",
|
128
|
+
|
129
|
+
#variations
|
130
|
+
narrow: false,
|
131
|
+
|
132
|
+
**kwargs
|
133
|
+
)
|
134
|
+
@kwargs = kwargs
|
135
|
+
@kwargs[:tag] = :div
|
136
|
+
@kwargs[:classes] = class_names(
|
137
|
+
@kwargs[:classes],
|
138
|
+
"blankslate",
|
139
|
+
"blankslate-narrow": narrow,
|
140
|
+
)
|
141
|
+
|
142
|
+
@title_tag = title_tag
|
143
|
+
@icon = icon
|
144
|
+
@icon_height = icon_height
|
145
|
+
@image_src = image_src
|
146
|
+
@image_alt = image_alt
|
147
|
+
@title = title
|
148
|
+
@description = description
|
149
|
+
@button_text = button_text
|
150
|
+
@button_url = button_url
|
151
|
+
@button_classes = button_classes
|
152
|
+
@link_text = link_text
|
153
|
+
@link_url = link_url
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|