Sha256: c93e88c8a647eb574ad54c623e84f3a715580ed31647986144dbfc9f0a5c6538

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

module Yattho
  module Beta
    # @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(Yattho::Beta::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(Yattho::Beta::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: "Click to copy!")
        render(Yattho::Beta::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
end

Version data entries

2 entries across 2 versions & 1 rubygems

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