Sha256: 438c7e65e8af0d25852591b424203b754937636fd6be018342ae374b3a9c812d

Contents?: true

Size: 1.51 KB

Versions: 2

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

require_relative "../url_helpers"

module Yattho
  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

2 entries across 2 versions & 1 rubygems

Version Path
yattho_view_components-0.1.1 previews/yattho/alpha/toggle_switch_preview.rb
yattho_view_components-0.0.1 previews/yattho/alpha/toggle_switch_preview.rb