app/components/lookbook/tabs/component.rb in lookbook-1.0.0.beta.0 vs app/components/lookbook/tabs/component.rb in lookbook-1.0.0.beta.1
- old
+ new
@@ -1,23 +1,21 @@
module Lookbook
class Tabs::Component < Lookbook::Component
- renders_many :tabs, ->(ref: nil, **attrs) do
+ renders_many :tabs, ->(**attrs) do
@tab_counter += 1
- ref ||= "tab-#{@tab_counter}"
- attrs = {
- ref: ref,
- position: @tab_counter,
- **attrs
- }
+ 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, ->(ref:, **attrs) do
- Lookbook::Tabs::DropdownTab::Component.new(ref: "dropdown-#{ref}", **attrs)
+ renders_many :dropdown_tabs, ->(name:, **attrs) do
+ Lookbook::Tabs::DropdownTab::Component.new(name: "dropdown-#{name}", **attrs)
end
- def initialize(**html_attrs)
+ def initialize(theme: :toolbar, **html_attrs)
+ @theme = theme
@tab_counter = 0
super(**html_attrs)
end
protected