Sha256: 17324d329c914858a843d6af98bc8d05e3e15239c9036f64208544ec44b662cc

Contents?: true

Size: 921 Bytes

Versions: 7

Compression:

Stored size: 921 Bytes

Contents

# frozen_string_literal: true

module Primer
  # @label ClipboardCopy
  class ClipboardCopyPreview < ViewComponent::Preview
    # @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

7 entries across 7 versions & 1 rubygems

Version Path
primer_view_components-0.0.104 previews/primer/clipboard_copy_preview.rb
primer_view_components-0.0.103 previews/primer/clipboard_copy_preview.rb
primer_view_components-0.0.102 previews/primer/clipboard_copy_preview.rb
primer_view_components-0.0.101 previews/primer/clipboard_copy_preview.rb
primer_view_components-0.0.100 previews/primer/clipboard_copy_preview.rb
primer_view_components-0.0.99 previews/primer/clipboard_copy_preview.rb
primer_view_components-0.0.98 previews/primer/clipboard_copy_preview.rb