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
openproject-primer_view_components-0.43.0 previews/primer/beta/breadcrumbs_preview.rb
primer_view_components-0.32.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.42.0 previews/primer/beta/breadcrumbs_preview.rb
primer_view_components-0.31.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.41.1 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.41.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.40.0 previews/primer/beta/breadcrumbs_preview.rb
primer_view_components-0.30.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.39.1 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.39.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.38.0 previews/primer/beta/breadcrumbs_preview.rb
primer_view_components-0.29.0 previews/primer/beta/breadcrumbs_preview.rb
primer_view_components-0.28.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.37.1 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.37.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.36.2 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.36.1 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.36.0 previews/primer/beta/breadcrumbs_preview.rb
primer_view_components-0.27.0 previews/primer/beta/breadcrumbs_preview.rb
openproject-primer_view_components-0.35.2 previews/primer/beta/breadcrumbs_preview.rb