Sha256: 3dec36037d5c9e96eb8b8ad471e9c12187127a5d3fb5805c1d94407dd53cc341

Contents?: true

Size: 1.51 KB

Versions: 16

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

require_relative "../url_helpers"

module Primer
  module Alpha
    # @label Toggle Switch
    class ToggleSwitchPreview < ViewComponent::Preview
      include ActionView::Helpers::FormTagHelper

      def playground
        render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path))
      end

      def default
        render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path))
      end

      def checked
        render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, checked: true))
      end

      def disabled
        render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, enabled: false))
      end

      def checked_disabled
        render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, checked: true, enabled: false))
      end

      def small
        render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, size: :small))
      end

      def with_status_label_position_end
        render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, status_label_position: :end))
      end

      def with_a_bad_src
        render(ToggleSwitch.new(src: "/foo"))
      end

      def with_no_src
        render(ToggleSwitch.new)
      end

      def with_csrf_token
        render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, csrf_token: "let_me_in"))
      end

      def with_bad_csrf_token
        render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, csrf_token: "i_am_a_criminal"))
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
primer_view_components-0.3.1 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.3.0 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.2.0 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.1.9 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.1.8 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.1.7 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.1.6 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.1.5 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.1.4 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.1.3 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.1.2 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.1.1 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.1.0 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.0.123 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.0.122 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.0.121 previews/primer/alpha/toggle_switch_preview.rb