Sha256: f314776446bc9eb1cf94c80843b64b83b5ee507a6d6f3c00912fcfc066a0a78b

Contents?: true

Size: 1.17 KB

Versions: 11

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

module Primer
  module Alpha
    # @label TabPanels
    class TabPanelsPreview < ViewComponent::Preview
      # @label Playground
      #
      # @param number_of_panels [Integer] number
      # @param align [Symbol] select [left, right]
      def playground(number_of_panels: 3, align: :left)
        render(Primer::Alpha::TabPanels.new(label: "label", align: align)) do |c|
          Array.new(number_of_panels || 3) do |i|
            c.tab(selected: i.zero?, id: "tab-#{i + 1}") do |t|
              t.panel { "Panel #{i + 1}" }
              t.text { "Tab #{i + 1}" }
            end
          end
        end
      end

      # @label Default options
      #
      # @param number_of_panels [Integer] number
      # @param align [Symbol] select [left, right]
      def default(number_of_panels: 3, align: :left)
        render(Primer::Alpha::TabPanels.new(label: "label", align: align)) do |c|
          Array.new(number_of_panels || 3) do |i|
            c.tab(selected: i.zero?, id: "tab-#{i + 1}") do |t|
              t.panel { "Panel #{i + 1}" }
              t.text { "Tab #{i + 1}" }
            end
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
primer_view_components-0.0.115 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.114 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.113 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.112 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.111 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.110 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.109 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.108 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.107 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.106 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.105 previews/primer/alpha/tab_panels_preview.rb