Sha256: 3e5ddded414965118bdc838e5017dce38bb04eec1387b5f4b64c75ee70453bc0

Contents?: true

Size: 1.77 KB

Versions: 23

Compression:

Stored size: 1.77 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 :full, type: Playbook::Props::Boolean, default: false
      prop :position, type: Playbook::Props::Enum,
                      values: %w[left right],
                      default: "left"
      prop :size, type: Playbook::Props::Enum,
                  values: %w[xs sm md lg xl],
                  default: "md"
      prop :transparent, type: Playbook::Props::Boolean, default: false
      prop :variant, type: Playbook::Props::Enum,
                  values: %w[light dark gradient],
                  default: "light"
      prop :layout, type: Playbook::Props::Enum,
            values: %w[sidebar collection kanban],
            default: "sidebar"

      prop :responsive, type: Playbook::Props::Boolean, default: false

      def classname
        case layout
	        when "collection" 
            generate_classname("pb_layout_kit", layout)
          when "kanban"
            generate_classname("pb_layout_kit", layout, responsive_class)
	        else
	          first_class = generate_classname("pb_layout_kit_sidebar","size_#{size}", position, variant, transparent_class)
	          [first_class, full_class, collapse_class].reject(&:empty?).join(" ")
        end
      end

    private

      def responsive_class
        responsive ? "responsive" : ""
      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

23 entries across 23 versions & 1 rubygems

Version Path
playbook_ui-5.2.0.pre.alpha15 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.2.0.pre.alpha14 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.2.0.pre.alpha13 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.2.0.pre.alpha12 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.2.0.pre.alpha11 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.2.0.pre.alpha10 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.2.0.pre.alpha9 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.2.0.pre.alpha8 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.2.0.pre.alpha7 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.2.0.pre.alpha6 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.2.0.pre.alpha5 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.2.0.pre.alpha4 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.2.0.pre.alpha3 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.2.0.pre.alpha2 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.1.0 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.0.3 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.0.2 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.0.1.pre.beta app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.1.0.pre.alpha4 app/pb_kits/playbook/pb_layout/layout.rb
playbook_ui-5.1.0.pre.alpha2 app/pb_kits/playbook/pb_layout/layout.rb