Module: Playbook::FlexShrink
- Included in:
- KitBase
- Defined in:
- lib/playbook/flex_shrink.rb
Constant Summary collapse
- FLEX_SHRINK_VALUES =
%w[1 0].freeze
- SCREEN_SIZES =
%w[xs sm md lg xl].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'lib/playbook/flex_shrink.rb', line 5 def self.included(base) base.prop :flex_shrink end |
Instance Method Details
#flex_shrink_options ⇒ Object
28 29 30 |
# File 'lib/playbook/flex_shrink.rb', line 28 def { flex_shrink: "flex_shrink" } end |
#flex_shrink_props ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/playbook/flex_shrink.rb', line 12 def flex_shrink_props value = flex_shrink return nil unless value if value.is_a?(::Hash) css = +"" css << "flex_shrink_#{value[:default]} " if value.key?(:default) && FLEX_SHRINK_VALUES.include?(value[:default].to_s) value.each do |media_size, shrink_value| css << "flex_shrink_#{media_size}_#{shrink_value} " if SCREEN_SIZES.include?(media_size.to_s) && FLEX_SHRINK_VALUES.include?(shrink_value.to_s) end css.strip unless css.empty? elsif FLEX_SHRINK_VALUES.include?(value.to_s) "flex_shrink_#{value}" end end |
#flex_shrink_values ⇒ Object
32 33 34 |
# File 'lib/playbook/flex_shrink.rb', line 32 def flex_shrink_values FLEX_SHRINK_VALUES end |