Sha256: 53165d54907f68112dae51613dbb6766d4b60da980d1ad73f40c3a674dbeb8cb

Contents?: true

Size: 1.96 KB

Versions: 27

Compression:

Stored size: 1.96 KB

Contents

# frozen_string_literal: true

module Primer
  module Beta
    # @label ProgressBar
    class ProgressBarPreview < ViewComponent::Preview
      # @label Playground
      #
      # @param size [Symbol] select [default, small, large]
      def playground(size: :default)
        render(Primer::Beta::ProgressBar.new(size: size)) do |component|
          component.with_item(percentage: 10)
          component.with_item(bg: :accent_emphasis, percentage: 20)
          component.with_item(bg: :danger_emphasis, percentage: 30)
        end
      end

      # @label Default
      #
      # @param size [Symbol] select [default, small, large]
      def default(size: :default)
        render(Primer::Beta::ProgressBar.new(size: size)) do |component|
          component.with_item(percentage: 10)
          component.with_item(bg: :accent_emphasis, percentage: 20)
          component.with_item(bg: :danger_emphasis, percentage: 30)
        end
      end

      # @!group Sizes
      #
      # @label Size small
      def size_small
        render(Primer::Beta::ProgressBar.new(size: :small)) do |component|
          component.with_item(percentage: 10)
          component.with_item(bg: :accent_emphasis, percentage: 20)
          component.with_item(bg: :danger_emphasis, percentage: 30)
        end
      end

      # @label Size default
      def size_default
        render(Primer::Beta::ProgressBar.new(size: :default)) do |component|
          component.with_item(percentage: 10)
          component.with_item(bg: :accent_emphasis, percentage: 20)
          component.with_item(bg: :danger_emphasis, percentage: 30)
        end
      end

      # @label Size large
      def size_large
        render(Primer::Beta::ProgressBar.new(size: :large)) do |component|
          component.with_item(percentage: 10)
          component.with_item(bg: :accent_emphasis, percentage: 20)
          component.with_item(bg: :danger_emphasis, percentage: 30)
        end
      end
      # @!endgroup
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
primer_view_components-0.0.116 previews/primer/beta/progress_bar_preview.rb
primer_view_components-0.0.115 previews/primer/beta/progress_bar_preview.rb
primer_view_components-0.0.114 previews/primer/beta/progress_bar_preview.rb
primer_view_components-0.0.113 previews/primer/beta/progress_bar_preview.rb
primer_view_components-0.0.112 previews/primer/beta/progress_bar_preview.rb
primer_view_components-0.0.111 previews/primer/beta/progress_bar_preview.rb
primer_view_components-0.0.110 previews/primer/beta/progress_bar_preview.rb