Sha256: 5b48cc96748d075f1b98c9b944b2116b282703c7d5cf2a5f184aa89d5addb5ab

Contents?: true

Size: 689 Bytes

Versions: 32

Compression:

Stored size: 689 Bytes

Contents

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

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

    def initialize(theme: :toolbar, **html_attrs)
      @theme = theme
      @tab_counter = 0
      super(**html_attrs)
    end

    protected

    def alpine_component
      "tabsComponent"
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
lookbook-1.4.5 app/components/lookbook/tabs/component.rb
lookbook-1.4.4 app/components/lookbook/tabs/component.rb
lookbook-1.4.3 app/components/lookbook/tabs/component.rb
lookbook-1.4.2 app/components/lookbook/tabs/component.rb
lookbook-1.4.1 app/components/lookbook/tabs/component.rb
lookbook-1.4.0 app/components/lookbook/tabs/component.rb
lookbook-1.3.4 app/components/lookbook/tabs/component.rb
lookbook-1.3.3 app/components/lookbook/tabs/component.rb
lookbook-1.3.1 app/components/lookbook/tabs/component.rb
lookbook-1.3.0 app/components/lookbook/tabs/component.rb
lookbook-1.2.1 app/components/lookbook/tabs/component.rb
lookbook-1.2.0 app/components/lookbook/tabs/component.rb
lookbook-1.1.1 app/components/lookbook/tabs/component.rb
lookbook-1.1.0 app/components/lookbook/tabs/component.rb
lookbook-1.0.8 app/components/lookbook/tabs/component.rb
lookbook-1.0.7 app/components/lookbook/tabs/component.rb
lookbook-1.0.6 app/components/lookbook/tabs/component.rb
lookbook-1.0.5 app/components/lookbook/tabs/component.rb
lookbook-1.0.4 app/components/lookbook/tabs/component.rb
lookbook-1.0.3 app/components/lookbook/tabs/component.rb