Sha256: 495ada1c75fb9dd1cb01e53954855f65b7a1f66b299a6f62a18c727fc7791610

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 KB

Contents

# frozen_string_literal: true

module Primer
  module Alpha
    # @label UnderlineNav
    class UnderlineNavPreview < ViewComponent::Preview
      # @label Default options
      #
      # @param label [String] text
      # @param tag [Symbol] select [div, nav]
      # @param align [Symbol] select [left, right]
      # @param number_of_panels [Integer] number
      def default(label: "Default with nav element", tag: :nav, align: :left, number_of_panels: 3)
        render_with_template(locals: {
                               label: label,
                               tag: tag,
                               align: align,
                               number_of_panels: number_of_panels
                             })
      end

      # @label With icons and counters
      #
      # @param label [String] text
      # @param tag [Symbol] select [div, nav]
      # @param align [Symbol] select [left, right]
      # @param number_of_panels [Integer] number
      def with_icons_and_counters(label: "With icons and counters", number_of_panels: 3, align: :left, tag: :nav)
        render(Primer::Alpha::UnderlineNav.new(label: label, tag: tag, align: align)) do |component|
          Array.new(number_of_panels || 3) do |i|
            component.with_tab(href: "#", selected: i.zero?) do |t|
              t.icon(icon: :star)
              t.text { "Item #{i + 1}" }
              t.counter(count: rand(1..10))
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
primer_view_components-0.0.101 previews/primer/alpha/underline_nav_preview.rb
primer_view_components-0.0.100 previews/primer/alpha/underline_nav_preview.rb
primer_view_components-0.0.99 previews/primer/alpha/underline_nav_preview.rb
primer_view_components-0.0.98 previews/primer/alpha/underline_nav_preview.rb