bulmacomp 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/app/components/bulmacomp/turbo_frame_component.rb +55 -0
- data/lib/bulmacomp/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88e7e5ad90eb4c31390ae4c94c074c1bbe32f338fe24ebd177e691c5a911bf46
|
4
|
+
data.tar.gz: db0492f09910419be900d5d67f9d261581bb9ba25a35ad99e56e40c926d595e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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/
|
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
|
data/lib/bulmacomp/version.rb
CHANGED
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.
|
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-
|
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
|