bulmacomp 1.0.0 → 1.0.2

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: 03f4ba3be9bf671e75a46e7e6269bb992e8249e595a939a045b71091ad74baa4
4
- data.tar.gz: 7f2455a6f4b08c00aae69819a2f603c46dd26bcd6c63546d2c39785d58393e63
3
+ metadata.gz: 88e7e5ad90eb4c31390ae4c94c074c1bbe32f338fe24ebd177e691c5a911bf46
4
+ data.tar.gz: db0492f09910419be900d5d67f9d261581bb9ba25a35ad99e56e40c926d595e0
5
5
  SHA512:
6
- metadata.gz: e5dd184d2ba86cd80d0b29660d0c20bb890cdfb61eb9468beb055281e66acce8346c31f1f002e696a322a11af2e004e35b3493a190fe9f2ca2923f57ac111ed7
7
- data.tar.gz: 31100768b00f36a1c5d7ba730a4235aae1a1816877d7f62c9a2ca6213ff81c6c19b245b6cd2939798b63b0f5a7a98ab98d5cd613787b0c1a572aacab2609a112
6
+ metadata.gz: c24b2fefa22d6c0482be54d7695554bde35bc5bb2d2ad25fb96889415f74e2733c61f2b90feb125700044434995095be42ec908104183906257dc681c9812994
7
+ data.tar.gz: 5246ce53530ceb51d52e27b7e3573bbf0d3c7a2238e0bd70264f6160e2e160b8d59e71db20b7cc0543a3a8db3ea2577e4cfa5152435f654bb7263ae7c69f6fb8
data/README.md CHANGED
@@ -17,7 +17,11 @@ Bulmacomp provide a "view component" for each bulma component:
17
17
  * [Navbar](https://bulma.io/documentation/components/navbar/) - [Bulmacomp::NavbarCompoent](https://www.rubydoc.info/github/isprambiente/bulmacomp/Bulmacomp/NavbarComponent)
18
18
  * [Pagination](https://bulma.io/documentation/components/pagination/) - [Bulmacomp::PaginationComponent](https://www.rubydoc.info/github/isprambiente/bulmacomp/Bulmacomp/PaginationComponent)
19
19
  * [Panel](https://bulma.io/documentation/components/panel/) - [Bulmacomp::PanelComponent](https://www.rubydoc.info/github/isprambiente/bulmacomp/Bulmacomp/PanelComponent)
20
- * [Tabs](https://bulma.io/documentation/components/tabs/) - [Bulmacomp::TabsComponent](https://www.rubydoc.info/github/isprambiente/bulmacomp/Bulmacomp/tabsComponent)
20
+ * [Tabs](https://bulma.io/documentation/components/tabs/) - [Bulmacomp::TabsComponent](https://www.rubydoc.info/github/isprambiente/bulmacomp/Bulmacomp/TabsComponent)
21
+
22
+ and generic rails components
23
+ * [Turbo Frame](https://turbo.hotwired.dev/handbook/frames) - [Bulmacomp::TurboFrameComponent](https://www.rubydoc.info/github/isprambiente/bulmacomp/Bulmacomp/TurboFrameComponent)
24
+
21
25
 
22
26
  ## Installation
23
27
  Add this line to your application's Gemfile:
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bulmacomp
4
+ # Make an HTML [turbo Frame](https://turbo.hotwired.dev/handbook/frames) structure.
5
+ #
6
+ # @example empty turbo frame, on default when the compoent is have't yield content, is added a lod icon
7
+ # = render Layout::TurboFrameComponent.new
8
+ #
9
+ # <turbo-frame>
10
+ # <span class="icon"><i class="fas fa-sync fa-spin fa-2x"></i></span>
11
+ # </turbo-frame>
12
+ #
13
+ # @example with id and src (to load remote content)
14
+ # = render Layout::TurboFrameComponent.new(id: 'nav1', src: books_path )
15
+ #
16
+ # <turbo-frame id='nav1' src='/books'>
17
+ # <span class="icon"><i class="fas fa-sync fa-spin fa-2x"></i></span>
18
+ # </turbo-frame>
19
+ #
20
+ # @example with no icon
21
+ # = render Layout::TurboFrameComponent.new(icon: nil, id: 'nav1', src: books_path )
22
+ #
23
+ # <turbo-frame id='nav1' src='/books'></turbo-frame>
24
+ #
25
+ # @example with yield content
26
+ # = render Layout::TurboFrameComponent.new do
27
+ # some text
28
+ #
29
+ # <turbo-frame>some text</turbo-frame>
30
+ class TurboFrameComponent < ViewComponent::Base
31
+ # @param [Hash] opts
32
+ # options to generate content
33
+ # @param [String] icon
34
+ # text to add whe yield content is empty
35
+ # default: [default_icon]
36
+ # @option opts [String] :*
37
+ # each other key going as tag option
38
+ # @yield [optional] turbo frame content
39
+ def initialize(icon: default_icon, **opts)
40
+ super
41
+ @icon = icon
42
+ @opts = opts
43
+ end
44
+
45
+ # @return [String] html turbo frame
46
+ def call
47
+ content_tag('turbo-frame', (content || @icon), **@opts)
48
+ end
49
+
50
+ # default value for icon
51
+ def default_icon
52
+ tag.span tag.i(class: 'fas fa-sync fa-spin fa-2x'), class: 'icon'
53
+ end
54
+ end
55
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bulmacomp
4
- VERSION = '1.0.0' # Costant of bulmacomp version
4
+ VERSION = '1.0.2' # Costant of bulmacomp version
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulmacomp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - MDreW
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-24 00:00:00.000000000 Z
11
+ date: 2023-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '7.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: view_component
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '2.76'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '2.76'
27
41
  description: Collection of view components for bulma css framework
28
42
  email:
29
43
  - andrea.ranaldi@gmail.com
@@ -44,6 +58,7 @@ files:
44
58
  - app/components/bulmacomp/pagination_component.rb
45
59
  - app/components/bulmacomp/panel_component.rb
46
60
  - app/components/bulmacomp/tabs_component.rb
61
+ - app/components/bulmacomp/turbo_frame_component.rb
47
62
  - lib/bulmacomp.rb
48
63
  - lib/bulmacomp/engine.rb
49
64
  - lib/bulmacomp/version.rb