bs5 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d4e64b1fb40e3224c42147923de60bb7233c2c2fbf411674e0bca31c093c837
4
- data.tar.gz: 80ef0fe973d5cab69eb75e4834dbaed31c1886d13c4f6586aeed655d0a69ba2a
3
+ metadata.gz: f4eeed7da6108bdb379e711c57a906f8cd5bc66730e0a79485f941b5a1a29651
4
+ data.tar.gz: 6b2819922250d5b3449def44bcde45703115fdd234697dbfd8476827d485fe0c
5
5
  SHA512:
6
- metadata.gz: a4b8e31ace3f99001251e99f0e8c7d2ad8e2320008223c7b346eeca08fcd9e39d2b59c208e181720a2c6e611550a6913e11cc941b0c92a89dffd73b4bf9d615d
7
- data.tar.gz: 10bcf562669a15ea680eea134048ab9ee32986e905e28173184ddf044842ac6dafdb507817a3154487e2fa5e567aaa2209313e25752b77e7699df18720adc630
6
+ metadata.gz: 9e034c5d510d1d5518bf505f7c40566db8898e2daedfd051e85312c3ab21b772604f9142cce65bf571564631b0832d6c7510f681bbdc5e1bce31fbe14c533588
7
+ data.tar.gz: 4c54522c6bb42cf7485a174ec6675e122211beb3b6e329507576237f15be6bfef0acd795cd76eebc969c9883a9cbd4f69b45067873d8d05b6703093473ad1ce0
data/README.md CHANGED
@@ -36,7 +36,31 @@ Run the following command to setup your project to use Bootstrap 5.
36
36
 
37
37
  ## Components
38
38
 
39
- ### [Accordion](https://v5.getbootstrap.com/docs/5.0/components/accordion/) ✅
39
+ - [Accordion](#accordion) ✅
40
+ - [Alert](#alert) ✅
41
+ - [Badge](#badge) ✅
42
+ - Breadcrumb
43
+ - Buttons
44
+ - Button group
45
+ - Card
46
+ - Carousel
47
+ - [Close button](#close-button) ✅
48
+ - Collapse
49
+ - Dropdowns
50
+ - List group
51
+ - Modal
52
+ - Nav & tabs
53
+ - Navbar
54
+ - Pagination
55
+ - Popovers
56
+ - Progress
57
+ - Scrollspy
58
+ - Spinners
59
+ - Toasts
60
+ - Tooltips
61
+
62
+
63
+ ### [Accordion](https://v5.getbootstrap.com/docs/5.0/components/accordion/)
40
64
 
41
65
  ```
42
66
  <%= bs5_accordion do |accordion| %>
@@ -66,7 +90,7 @@ Run the following command to setup your project to use Bootstrap 5.
66
90
  <%- end %>
67
91
  ```
68
92
 
69
- ### [Alert](https://v5.getbootstrap.com/docs/5.0/components/alerts/)
93
+ ### [Alert](https://v5.getbootstrap.com/docs/5.0/components/alerts/)
70
94
 
71
95
  ```
72
96
  <%= bs5_alert do %>
@@ -80,7 +104,7 @@ Run the following command to setup your project to use Bootstrap 5.
80
104
  <%- end %>
81
105
  ```
82
106
 
83
- ### [Badge](https://v5.getbootstrap.com/docs/5.0/components/badge/)
107
+ ### [Badge](https://v5.getbootstrap.com/docs/5.0/components/badge/)
84
108
 
85
109
  ```
86
110
  <%= bs5_badge(text: 'New') %>
@@ -99,6 +123,24 @@ Run the following command to setup your project to use Bootstrap 5.
99
123
 
100
124
  ### [Button](https://v5.getbootstrap.com/docs/5.0/components/buttons/)
101
125
 
126
+ ### [Close button](https://v5.getbootstrap.com/docs/5.0/components/close-button/)
127
+
128
+ ```
129
+ <%= bs5_close_button %>
130
+ ```
131
+
132
+ ```
133
+ <%= bs5_close_button(disabled: true) %>
134
+ ```
135
+
136
+ ```
137
+ <%= bs5_close_button(white: true) %>
138
+ ```
139
+
140
+ ```
141
+ <%= bs5_close_button(data: { controller: 'hello', action: "click->hello#greet }) %>
142
+ ```
143
+
102
144
  ## Previewing components
103
145
 
104
146
  - http://localhost:3000/rails/view_components
@@ -1,6 +1,6 @@
1
1
  <div class="<%= component_class %>" role="alert">
2
2
  <%= content %>
3
3
  <%- if is_dismissable %>
4
- <button type="button" class="btn-close" data-dismiss="alert" aria-label="Close"></button>
4
+ <%= render Bs5::CloseButtonComponent.new(data: { dismiss: :alert }) %>
5
5
  <%- end %>
6
6
  </div>
@@ -0,0 +1,7 @@
1
+ <%= button_tag '',
2
+ type: 'button',
3
+ class: component_class,
4
+ disabled: disabled?,
5
+ aria: { label: 'Close'},
6
+ data: data
7
+ %>
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bs5
4
+ class CloseButtonComponent < ViewComponent::Base
5
+ attr_reader :data
6
+
7
+ def initialize(disabled: false, white: false, data: nil)
8
+ @disabled = disabled
9
+ @white = white
10
+ @data = data
11
+ end
12
+
13
+ private
14
+
15
+ def white?
16
+ @white
17
+ end
18
+
19
+ def disabled?
20
+ @disabled
21
+ end
22
+
23
+ def component_class
24
+ class_names = ['btn-close']
25
+ class_names << %w[btn-close-white] if white?
26
+ class_names.join(' ')
27
+ end
28
+ end
29
+ end
@@ -17,5 +17,9 @@ module Bs5
17
17
  def bs5_badge(*args)
18
18
  render BadgeComponent.new(*args)
19
19
  end
20
+
21
+ def bs5_close_button(*args)
22
+ render CloseButtonComponent.new(*args)
23
+ end
20
24
  end
21
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bs5
4
- VERSION = '0.0.4'
4
+ VERSION = '0.0.5'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bs5
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Baselier
@@ -104,6 +104,8 @@ files:
104
104
  - app/components/bs5/alert_component.rb
105
105
  - app/components/bs5/badge_component.html.erb
106
106
  - app/components/bs5/badge_component.rb
107
+ - app/components/bs5/close_button_component.html.erb
108
+ - app/components/bs5/close_button_component.rb
107
109
  - app/controllers/bs5/application_controller.rb
108
110
  - app/helpers/bs5/application_helper.rb
109
111
  - app/helpers/bs5/components_helper.rb