Sha256: 538f00f720c31b284320e52c8ac3627fa422e1738192e9f7283fabb83ecd4899

Contents?: true

Size: 741 Bytes

Versions: 3

Compression:

Stored size: 741 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbCheckbox
    class Checkbox
      include Playbook::Props

      partial "pb_checkbox/checkbox"

      prop :dark, type: Playbook::Props::Boolean, default: false
      prop :checked, type: Playbook::Props::Boolean, default: false
      prop :icon, type: Playbook::Props::Boolean, default: false
      prop :text
      prop :value
      prop :name

      def checked_html
        checked ? "checked='true'" : nil
      end

      def classname
        generate_classname("pb_checkbox_kit", dark_class, checked_class)
      end

    private

      def checked_class
        checked ? "on" : "off"
      end

      def dark_class
        dark ? "dark" : nil
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
playbook_ui-2.9.4 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-2.9.3 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-2.9.2 app/pb_kits/playbook/pb_checkbox/checkbox.rb