Sha256: ce7d1d394b291a8f661f37bdf536fea15088becf5763b50ffb51e833a031cb54

Contents?: true

Size: 664 Bytes

Versions: 1

Compression:

Stored size: 664 Bytes

Contents

module Lookbook
  class Tabs::Component < Lookbook::Component
    renders_many :tabs, ->(ref: nil, **attrs) do
      @tab_counter += 1
      ref ||= "tab-#{@tab_counter}"
      attrs = {
        ref: ref,
        position: @tab_counter,
        **attrs
      }
      dropdown_tab(**attrs)
      Lookbook::Tabs::Tab::Component.new(**attrs)
    end

    renders_many :dropdown_tabs, ->(ref:, **attrs) do
      Lookbook::Tabs::DropdownTab::Component.new(ref: "dropdown-#{ref}", **attrs)
    end

    def initialize(**html_attrs)
      @tab_counter = 0
      super(**html_attrs)
    end

    protected

    def alpine_component
      "tabsComponent"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lookbook-1.0.0.beta.0 app/components/lookbook/tabs/component.rb