docs/components/tabs.rb in phlex-0.2.2 vs docs/components/tabs.rb in phlex-0.3.0
- old
+ new
@@ -1,30 +1,30 @@
# frozen_string_literal: true
module Components
- class Tabs < Phlex::Component
- def initialize
- @index = 1
- end
+ class Tabs < Phlex::View
+ def initialize
+ @index = 1
+ end
- def template(&block)
- div class: "tabs flex flex-wrap relative my-5", role: "tablist" do
- content(&block)
- end
- end
+ def template(&block)
+ div class: "tabs flex flex-wrap relative my-5", role: "tablist" do
+ yield_content(&block)
+ end
+ end
- def tab(name, &block)
- render(Tab.new(name: name, checked: first?), &block)
- @index += 1
- end
+ def tab(name, &block)
+ render(Tab.new(name: name, checked: first?), &block)
+ @index += 1
+ end
- def unique_identifier
- @unique_identifier ||= SecureRandom.hex
- end
+ def unique_identifier
+ @unique_identifier ||= SecureRandom.hex
+ end
- private
+ private
- def first?
- @index == 1
- end
- end
+ def first?
+ @index == 1
+ end
+ end
end