Sha256: 3154ee50f9b625c9102bfcc10e8caca28b4dd770cf55105738c45f01cb7b1324

Contents?: true

Size: 1.51 KB

Versions: 6

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

6 entries across 6 versions & 1 rubygems

Version Path
primer_view_components-0.0.120 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.0.119 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.0.118 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.0.117 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.0.116 previews/primer/alpha/toggle_switch_preview.rb
primer_view_components-0.0.115 previews/primer/alpha/toggle_switch_preview.rb