Sha256: 62f0cd3727f97ba4dbddc63d7a15b31b55b781991ed726eb7227911b3274074e

Contents?: true

Size: 1.24 KB

Versions: 8

Compression:

Stored size: 1.24 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 |component|
          Array.new(number_of_panels || 3) do |i|
            component.with_tab(selected: i.zero?, id: "tab-#{i + 1}") do |tab|
              tab.with_panel { "Panel #{i + 1}" }
              tab.with_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 |component|
          Array.new(number_of_panels || 3) do |i|
            component.with_tab(selected: i.zero?, id: "tab-#{i + 1}") do |tab|
              tab.with_panel { "Panel #{i + 1}" }
              tab.with_text { "Tab #{i + 1}" }
            end
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
primer_view_components-0.1.0 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.123 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.122 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.121 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.120 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.119 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.118 previews/primer/alpha/tab_panels_preview.rb
primer_view_components-0.0.117 previews/primer/alpha/tab_panels_preview.rb