Sha256: e31cb0dd095022e2ccb07961d6c3c7b656b576ef01c4f81f1fdcc307396acc0a
Contents?: true
Size: 476 Bytes
Versions: 4
Compression:
Stored size: 476 Bytes
Contents
# frozen_string_literal: true module Components class Tabs < Phlex::View 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.4.0 | docs/components/tabs.rb |
phlex-0.3.2 | docs/components/tabs.rb |
phlex-0.3.1 | docs/components/tabs.rb |
phlex-0.3.0 | docs/components/tabs.rb |