Sha256: 7def7b4fec08c063d8ebcef4fbdd0fded596235dd023d22d128fc1fe7cc2b5aa

Contents?: true

Size: 1.96 KB

Versions: 2

Compression:

Stored size: 1.96 KB

Contents

# frozen_string_literal: true

module Yattho
  module Beta
    # @label ProgressBar
    class ProgressBarPreview < ViewComponent::Preview
      # @label Playground
      #
      # @param size [Symbol] select [default, small, large]
      def playground(size: :default)
        render(Yattho::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(Yattho::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(Yattho::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(Yattho::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(Yattho::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

2 entries across 2 versions & 1 rubygems

Version Path
yattho_view_components-0.1.1 previews/yattho/beta/progress_bar_preview.rb
yattho_view_components-0.0.1 previews/yattho/beta/progress_bar_preview.rb