Sha256: 12f3c50405651788575387fc0550047628f6efb03b691b852a6883aab203d69e

Contents?: true

Size: 1.16 KB

Versions: 8

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

module Primer
  # @label ClipboardCopy
  class ClipboardCopyPreview < ViewComponent::Preview
    # @label Playground
    #
    # @param aria_label [String]
    # @param value [String]
    def playground(value: "Text to copy", aria_label: "Copy text to the system clipboard")
      render(Primer::ClipboardCopy.new(value: value, "aria-label": aria_label))
    end

    # @label Default Options
    #
    # @param aria_label [String]
    # @param value [String]
    def default(value: "Text to copy", aria_label: "Copy text to the system clipboard")
      render(Primer::ClipboardCopy.new(value: value, "aria-label": aria_label))
    end

    # @label With text instead of icons
    #
    # @param aria_label [String]
    # @param value [String]
    def text(value: "Text to copy", aria_label: "Copy text to the system clipboard")
      render(Primer::ClipboardCopy.new(value: value, "aria-label": aria_label)) { "Click to copy!" }
    end

    # @label Copying from an element
    #
    # @param aria_label [String]
    def element(aria_label: "Copy text to the system clipboard")
      render_with_template(locals: { aria_label: aria_label })
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
primer_view_components-0.0.112 previews/primer/clipboard_copy_preview.rb
primer_view_components-0.0.111 previews/primer/clipboard_copy_preview.rb
primer_view_components-0.0.110 previews/primer/clipboard_copy_preview.rb
primer_view_components-0.0.109 previews/primer/clipboard_copy_preview.rb
primer_view_components-0.0.108 previews/primer/clipboard_copy_preview.rb
primer_view_components-0.0.107 previews/primer/clipboard_copy_preview.rb
primer_view_components-0.0.106 previews/primer/clipboard_copy_preview.rb
primer_view_components-0.0.105 previews/primer/clipboard_copy_preview.rb