Sha256: ac8acc5cc15d781deeb92085e045cc1c3002b74897bebfeacbe2833250c51a2f
Contents?: true
Size: 476 Bytes
Versions: 4
Compression:
Stored size: 476 Bytes
Contents
# frozen_string_literal: true module Components class Tabs < Phlex::HTML def initialize @index = 1 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 unique_identifier @unique_identifier ||= SecureRandom.hex end private def first? @index == 1 end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
phlex-0.5.3 | docs/components/tabs.rb |
phlex-0.5.2 | docs/components/tabs.rb |
phlex-0.5.1 | docs/components/tabs.rb |
phlex-0.5.0 | docs/components/tabs.rb |