Class: Bulmacomp::PanelComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Bulmacomp::PanelComponent
- Defined in:
- app/components/bulmacomp/panel_component.rb
Overview
Make an html structure for a bulma breadcrumb
Instance Method Summary collapse
-
#call ⇒ Object
return [String] html_safe generated bulma panel.
-
#initialize(title: nil, **opts) {|optional| ... } ⇒ PanelComponent
constructor
A new instance of PanelComponent.
-
#title ⇒ Object
return [String] html_safe generated panel title.
Constructor Details
#initialize(title: nil, **opts) {|optional| ... } ⇒ PanelComponent
Returns a new instance of PanelComponent.
35 36 37 38 39 |
# File 'app/components/bulmacomp/panel_component.rb', line 35 def initialize(title: nil, **opts) super @title = title @opts = { class: 'panel' }.merge(opts) end |
Instance Method Details
#call ⇒ Object
return [String] html_safe generated bulma panel
42 43 44 |
# File 'app/components/bulmacomp/panel_component.rb', line 42 def call content_tag :nav, safe_join([title, content]), **@opts end |
#title ⇒ Object
return [String] html_safe generated panel title
47 48 49 |
# File 'app/components/bulmacomp/panel_component.rb', line 47 def title tag.p @title, class: 'panel-heading' if @title end |