Sha256: 83c1a6221becc195cece5d6762d5cd1dc6b607931fbc8a40c0975e1ca6e57cff

Contents?: true

Size: 406 Bytes

Versions: 2

Compression:

Stored size: 406 Bytes

Contents

module Lookbook
  class PageTabs::Component < Lookbook::Component
    renders_many :tabs, ->(**attrs, &block) do
      @tabs ||= []
      attrs[:content] = capture(&block)
      attrs[:markdown] ||= @markdown
      @tabs << attrs
    end

    def initialize(markdown: true, **html_attrs)
      @markdown = markdown
      super(**html_attrs)
    end

    def before_render
      tabs.size
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lookbook-1.0.0.beta.2 app/components/lookbook/page_tabs/component.rb
lookbook-1.0.0.beta.1 app/components/lookbook/page_tabs/component.rb