Sha256: 535909831ee7f8bd025c57827c1b738bd59d45be8a56aff15a8273a642528acc

Contents?: true

Size: 1.44 KB

Versions: 44

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

module Primer
  module Beta
    # @label Breadcrumbs
    class BreadcrumbsPreview < ViewComponent::Preview
      # @label Playground
      #
      # @param number_of_links [Integer] number
      def playground(number_of_links: 2)
        render(Primer::Beta::Breadcrumbs.new) do |component|
          Array.new(number_of_links&.to_i || 3) do |i|
            component.with_item(href: "##{i}") { "Breadcrumb Item #{i + 1}" }
          end
        end
      end

      # @label Default options
      #
      # @param number_of_links [Integer] number
      # @snapshot
      def default(number_of_links: 2)
        render(Primer::Beta::Breadcrumbs.new) do |component|
          Array.new(number_of_links&.to_i || 3) do |i|
            component.with_item(href: "##{i}") { "Breadcrumb Item #{i + 1}" }
          end
        end
      end

      # @label WithBetaTruncate
      # @snapshot
      def with_beta_truncate
        render_with_template
      end

      # @label WithDeprecatedTruncate
      # @snapshot
      def with_deprecated_truncate
        render_with_template
      end

      # @label With a specific link target
      def with_link_target(number_of_links: 2)
        render(Primer::Beta::Breadcrumbs.new) do |component|
          Array.new(number_of_links&.to_i || 3) do |i|
            component.with_item(href: "##{i}", target: "_blank") { "Breadcrumb Item #{i + 1}" }
          end
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
primer_view_components-0.35.2 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.49.1 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.49.0 previews/primer/beta/breadcrumbs_preview.rb
primer_view_components-0.35.1 previews/primer/beta/breadcrumbs_preview.rb
primer_view_components-0.35.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.48.2 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.48.1 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.48.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.47.1 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.47.0 previews/primer/beta/breadcrumbs_preview.rb
primer_view_components-0.34.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.46.1 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.46.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.45.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.44.3 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.44.2 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.44.1 previews/primer/beta/breadcrumbs_preview.rb
primer_view_components-0.33.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.44.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.43.1 previews/primer/beta/breadcrumbs_preview.rb