bulmacomp 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 647bf29f1a9fab7a95e21df2d882988ec017f863d3810d921a2cb48669ff919f
4
- data.tar.gz: 214f9696e9785dd75b54f503d91a050e3429b84b39ded5ce928635b8e22b7d13
3
+ metadata.gz: 88e7e5ad90eb4c31390ae4c94c074c1bbe32f338fe24ebd177e691c5a911bf46
4
+ data.tar.gz: db0492f09910419be900d5d67f9d261581bb9ba25a35ad99e56e40c926d595e0
5
5
  SHA512:
6
- metadata.gz: 85eff114f624eb7351346cc182ace4219e3b7914f72232aa955158119651aee2a9d03ac677eb33d007f06a4f73f0cb8792a750a033dff48b29dd8c0087f3a581
7
- data.tar.gz: 722d8526dbdb501bfd1deb8f30a4a80a0ee7c16e35f8c5f789b44be8f894ca038172a53851203dd6d5778d7cd95946c863576d58a45a560d4f7cb06d4a92fc63
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.1' # 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.1
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-26 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
@@ -58,6 +58,7 @@ files:
58
58
  - app/components/bulmacomp/pagination_component.rb
59
59
  - app/components/bulmacomp/panel_component.rb
60
60
  - app/components/bulmacomp/tabs_component.rb
61
+ - app/components/bulmacomp/turbo_frame_component.rb
61
62
  - lib/bulmacomp.rb
62
63
  - lib/bulmacomp/engine.rb
63
64
  - lib/bulmacomp/version.rb