Sha256: 22941de311818e279e0720b28c47c30b442f5e1c40f19a238c2917b98645d43a

Contents?: true

Size: 1.48 KB

Versions: 329

Compression:

Stored size: 1.48 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbFlex
    class FlexItem < Playbook::KitBase
      prop :fixed_size, default: nil
      prop :grow, type: Playbook::Props::Boolean,
                  default: false
      prop :shrink, type: Playbook::Props::Boolean,
                    default: false

      prop :overflow, type: Playbook::Props::Enum,
                      values: %w[auto hidden inherit initial scroll visible] + [nil],
                      default: nil

      prop :align_self, type: Playbook::Props::Enum,
                        values: %w[start center end stretch] + [nil],
                        default: nil

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

      def classname
        generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class, display_flex_class) + overflow_class + align_self_class
      end

      def style_value
        "flex-basis: #{fixed_size};" if fixed_size.present?
      end

    private

      def align_self_class
        align_self ? "align_self_#{align_self}" : ""
      end

      def display_flex_class
        display_flex ? "display_flex" : nil
      end

      def fixed_size_class
        fixed_size.present? ? "fixed_size" : nil
      end

      def grow_class
        grow ? "grow" : nil
      end

      def overflow_class
        overflow ? " overflow_#{overflow}" : ""
      end

      def shrink_class
        shrink ? "shrink" : nil
      end
    end
  end
end

Version data entries

329 entries across 329 versions & 1 rubygems

Version Path
playbook_ui-12.38.0.pre.alpha.audiencesalpha1083 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.38.0.pre.alpha.PLAY966collapsiblenav41082 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.38.0.pre.alpha.PLAYaddingdatapropselectkit1080 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.37.0.pre.alpha.PLAY951collapsiblenav31078 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.38.0.pre.alpha.playbook123801077 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.37.0.pre.alpha.PLAY951collapsiblenav31074 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.37.0.pre.alpha.PLAY951collapsiblenav31073 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.37.0.pre.alpha.PLAYaddingdatapropselectkit1071 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.38.0 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.37.0.pre.alpha.svgiconmethods1064 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.37.0.pre.alpha.PLAY951collapsiblenav31062 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.37.0 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.36.0.pre.alpha.svgiconmethods1059 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.36.0.pre.alpha.PLAY936momentjs1058 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.36.0.pre.alpha.PLAY936momentjs1050 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.36.0.pre.alpha.PLAY936momentjs1047 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.36.0.pre.alpha.svgiconmethods1043 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.36.0.pre.alpha.PLAY942collapsiblenav21035 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.36.0 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-12.35.0.pre.alpha.iconpocwebfonts1023 app/pb_kits/playbook/pb_flex/flex_item.rb