Class: Bulmacomp::TurboFrameComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Bulmacomp::TurboFrameComponent
- Defined in:
- app/components/bulmacomp/turbo_frame_component.rb
Overview
Make an HTML [turbo Frame](turbo.hotwired.dev/handbook/frames) structure.
Instance Method Summary collapse
-
#call ⇒ String
Html turbo frame.
-
#default_icon ⇒ Object
default value for icon.
-
#initialize(icon: default_icon, **opts) {|optional| ... } ⇒ TurboFrameComponent
constructor
A new instance of TurboFrameComponent.
Constructor Details
#initialize(icon: default_icon, **opts) {|optional| ... } ⇒ TurboFrameComponent
Returns a new instance of TurboFrameComponent.
39 40 41 42 43 |
# File 'app/components/bulmacomp/turbo_frame_component.rb', line 39 def initialize(icon: default_icon, **opts) super @icon = icon @opts = opts end |
Instance Method Details
#call ⇒ String
Returns html turbo frame.
46 47 48 |
# File 'app/components/bulmacomp/turbo_frame_component.rb', line 46 def call content_tag('turbo-frame', (content || @icon), **@opts) end |
#default_icon ⇒ Object
default value for icon
51 52 53 |
# File 'app/components/bulmacomp/turbo_frame_component.rb', line 51 def default_icon tag.span tag.i(class: 'fas fa-sync fa-spin fa-2x'), class: 'icon' end |