Sha256: 0ae161082bdb694d01cc2af052245c5afb5d7ece124dbb2b2d04a00f381cb77b

Contents?: true

Size: 1.21 KB

Versions: 535

Compression:

Stored size: 1.21 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 :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) + 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 shrink_class
        shrink ? "shrink" : nil
      end
    end
  end
end

Version data entries

535 entries across 535 versions & 1 rubygems

Version Path
playbook_ui-14.6.1 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.7.0.pre.rc.1 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.6.0.pre.rc.22 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.6.0.pre.rc.21 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4175 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.6.0.pre.rc.20 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4162 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.5.0.pre.alpha.PBNTR595popoverwidthpropfilterpopoverprop4158 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.5.0.pre.alpha.PBNTR614advancedtablepoc4155 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.6.0.pre.rc.19 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.6.0.pre.rc.18 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.5.0.pre.alpha.play1549upgradereactmodal4130 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.5.0.pre.alpha.PLAY1601updatereactzoompanpinch4128 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.5.0.pre.alpha.PLAY1601updatereactzoompanpinch4123 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.6.0.pre.rc.17 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.5.0.pre.alpha.play1586datearea4115 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.6.0.pre.rc.16 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.5.0.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4098 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.5.0.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4097 app/pb_kits/playbook/pb_flex/flex_item.rb
playbook_ui-14.5.0.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4094 app/pb_kits/playbook/pb_flex/flex_item.rb