Module: Playbook::FlexDirection
- Included in:
- KitBase
- Defined in:
- lib/playbook/flex_direction.rb
Constant Summary collapse
- FLEX_DIRECTION_VALUES =
%w[row column rowReverse columnReverse].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_direction.rb', line 5 def self.included(base) base.prop :flex_direction end |
Instance Method Details
#flex_direction_options ⇒ Object
28 29 30 |
# File 'lib/playbook/flex_direction.rb', line 28 def { flex_direction: "flex_direction" } end |
#flex_direction_props ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/playbook/flex_direction.rb', line 12 def flex_direction_props value = flex_direction return nil unless value if value.is_a?(::Hash) css = +"" css << "flex_direction_#{value[:default].underscore} " if value.key?(:default) && FLEX_DIRECTION_VALUES.include?(value[:default]) value.each do |media_size, flex_value| css << "flex_direction_#{media_size}_#{flex_value.underscore} " if SCREEN_SIZES.include?(media_size.to_s) && FLEX_DIRECTION_VALUES.include?(flex_value) end css.strip unless css.empty? elsif FLEX_DIRECTION_VALUES.include?(value) "flex_direction_#{value.underscore}" end end |
#flex_direction_values ⇒ Object
32 33 34 |
# File 'lib/playbook/flex_direction.rb', line 32 def flex_direction_values FLEX_DIRECTION_VALUES end |