Sha256: 26d06de66b226b4d02a5e8d50d693c2543a97636bb3f80381e803f968a4cedf3

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbLayout
    class Layout
      include Playbook::Props

      partial "pb_layout/layout"

      prop :collapse, type: Playbook::Props::Enum,
                      values: %w[xs sm md lg xl],
                      default: "xs"
      prop :dark, type: Playbook::Props::Boolean, default: false
      prop :full, type: Playbook::Props::Boolean, default: false
      prop :position, type: Playbook::Props::Enum,
                      values: %w[left right],
                      default: "left"
      prop :transparent, type: Playbook::Props::Boolean, default: false
      prop :size, type: Playbook::Props::Enum,
                  values: %w[xs sm md lg xl],
                  default: "md"

      def classname
        first_class = generate_classname("pb_layout", size, position, dark_class, transparent_class)
        classname = first_class + full_class + collapse_class
        [first_class, full_class, collapse_class].reject(&:empty?).join(" ")
      end

    private

      def dark_class
        dark ? "dark" : nil
      end

      def full_class
        full ? "full" : ""
      end

      def transparent_class
        transparent ? "transparent" : nil
      end

      def collapse_class
        "layout_#{position}_collapse_#{collapse}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
playbook_ui-2.9.8 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-2.9.7 app/pb_kits/playbook/pb_layout/layout.rb