Sha256: c7de3f09b4a8c006334a3d644e7a10715bcd558442f8295b6ff09cad68fcd538

Contents?: true

Size: 1.46 KB

Versions: 54

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbList
    class List < Playbook::KitBase
      prop :borderless, type: Playbook::Props::Boolean,
                        default: false
      prop :dark, type: Playbook::Props::Boolean,
                  default: false
      prop :layout, type: Playbook::Props::Enum,
                    values: ["left", "right", ""],
                    default: ""
      prop :size
      prop :ordered, type: Playbook::Props::Boolean,
                     default: false
      prop :xpadding, type: Playbook::Props::Boolean,
                      default: false
      prop :role
      prop :tabindex

      def list_classname
        [
          "pb_list_kit",
          xpadding_class,
          borderless_class,
          dark_class,
          size_class,
          layout_class,
        ].compact.join("_")
      end

      def ordered_class
        ordered ? "ol" : "ul"
      end

    private

      def borderless_class
        borderless ? "borderless" : nil
      end

      def dark_class
        dark ? "dark" : nil
      end

      # rubocop:disable Style/CaseLikeIf
      def layout_class
        if layout == "right"
          "layout_right"
        elsif layout == "left"
          "layout_left"
        else
          ""
        end
      end
      # rubocop:enable Style/CaseLikeIf

      def size_class
        size ? "large" : nil
      end

      def xpadding_class
        xpadding ? "xpadding" : nil
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
playbook_ui-11.2.7 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.2.6 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.2.5 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.2.3 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.2.2 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.2.1 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.2.0 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.1.2 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.1.2.pre.alpha1 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.1.1 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.1.1.pre.alpha1 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.1.0 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.0.1 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.0.0 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.0.0.pre.alpha.2 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-11.0.0.pre.alpha.1 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-10.26.1 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-10.27.0.pre.lazysizes1 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-10.27.0.pre.datepicker1 app/pb_kits/playbook/pb_list/list.rb
playbook_ui-10.26.0 app/pb_kits/playbook/pb_list/list.rb