Class: Bulmacomp::TabsComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Bulmacomp::TabsComponent
- Defined in:
- app/components/bulmacomp/tabs_component.rb
Overview
Make an HTML strucrure for a bulma tabs
Instance Method Summary collapse
-
#call ⇒ String
Html_safe tabs.
-
#initialize(elements: [], **opts) {|optional| ... } ⇒ TabsComponent
constructor
A new instance of TabsComponent.
-
#ul_content ⇒ Text
, safe join of elements arguments and proc content.
Constructor Details
#initialize(elements: [], **opts) {|optional| ... } ⇒ TabsComponent
Returns a new instance of TabsComponent.
54 55 56 57 58 |
# File 'app/components/bulmacomp/tabs_component.rb', line 54 def initialize(elements: [], **opts) super @elements = elements @opts = { class: 'tabs' }.merge(opts) end |
Instance Method Details
#call ⇒ String
Returns html_safe tabs.
61 62 63 |
# File 'app/components/bulmacomp/tabs_component.rb', line 61 def call tag.div tag.ul(ul_content), **@opts end |
#ul_content ⇒ Text
Returns , safe join of elements arguments and proc content.
66 67 68 |
# File 'app/components/bulmacomp/tabs_component.rb', line 66 def ul_content safe_join([@elements.map { |e| tag.li(e) }, content]) end |