Sha256: 3fd2cd8228f4ec17923a8a609390cb9d3c13380f0e62f87c17d37b2a339d4be9

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module Primer
  module Alpha
    # @label StackItem
    class StackItemPreview < ViewComponent::Preview
      # @label Default
      def default
      end

      # @label Playground
      #
      # @param tag text
      # @param grow toggle
      # @param grow_narrow toggle
      # @param grow_regular toggle
      # @param grow_wide toggle
      def playground(
        tag: Primer::Alpha::StackItem::DEFAULT_TAG,
        grow: Primer::Alpha::StackItem::GrowArg::DEFAULT,
        grow_narrow: Primer::Alpha::StackItem::GrowArg::DEFAULT,
        grow_regular: Primer::Alpha::StackItem::GrowArg::DEFAULT,
        grow_wide: Primer::Alpha::StackItem::GrowArg::DEFAULT
      )
        render_with_template(locals: {
          system_arguments: {
            tag: tag,
            grow: control_values_for(grow, grow_narrow, grow_regular, grow_wide)
          }
        })
      end

      private

      def control_values_for(normal, narrow, regular, wide)
        [narrow, regular, wide].any? ? { narrow: narrow, regular: regular, wide: wide} : normal
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
openproject-primer_view_components-0.49.2 previews/primer/alpha/stack_item_preview.rb
primer_view_components-0.35.2 previews/primer/alpha/stack_item_preview.rb
openproject-primer_view_components-0.49.1 previews/primer/alpha/stack_item_preview.rb
openproject-primer_view_components-0.49.0 previews/primer/alpha/stack_item_preview.rb
primer_view_components-0.35.1 previews/primer/alpha/stack_item_preview.rb
primer_view_components-0.35.0 previews/primer/alpha/stack_item_preview.rb