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 |
# File 'app/components/bulmacomp/turbo_frame_component.rb', line 39 def initialize(icon: default_icon, **opts) @icon = icon @opts = opts end |
Instance Method Details
#call ⇒ String
Returns html turbo frame.
45 46 47 |
# File 'app/components/bulmacomp/turbo_frame_component.rb', line 45 def call content_tag("turbo-frame", content || @icon, **@opts) end |
#default_icon ⇒ Object
default value for icon
50 51 52 |
# File 'app/components/bulmacomp/turbo_frame_component.rb', line 50 def default_icon tag.span tag.i(class: "fas fa-sync fa-spin fa-2x"), class: "icon" end |