Module: Playbook::FlexDirection
- Included in:
- KitBase
- Defined in:
- lib/playbook/flex_direction.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#flex_direction_options ⇒ Object
rubocop:enable Style/IfInsideElse.
-
#flex_direction_props ⇒ Object
rubocop:disable Style/IfInsideElse.
- #flex_direction_values ⇒ Object
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
rubocop:enable Style/IfInsideElse
37 38 39 40 41 |
# File 'lib/playbook/flex_direction.rb', line 37 def { flex_direction: "flex_direction", } end |
#flex_direction_props ⇒ Object
rubocop:disable Style/IfInsideElse
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/playbook/flex_direction.rb', line 10 def flex_direction_props selected_props = .keys.select { |sk| try(sk) } return nil unless selected_props.present? screen_size_values = %w[xs sm md lg xl] selected_props.map do |k| flex_direction_value = send(k) if flex_direction_value.is_a?(Hash) class_result = [] # Handle default value separately (generates base class without size prefix) class_result << "flex_direction_#{flex_direction_value[:default].underscore}" if flex_direction_value.key?(:default) && flex_direction_values.include?(flex_direction_value[:default]) # Handle responsive sizes (generates classes with size prefix) flex_direction_value.each do |media_size, flex_value| class_result << "flex_direction_#{media_size}_#{flex_value.underscore}" if screen_size_values.include?(media_size.to_s) && flex_direction_values.include?(flex_value) end class_result else "flex_direction_#{flex_direction_value.underscore}" if flex_direction_values.include? flex_direction_value end end.flatten.compact.join(" ") end |
#flex_direction_values ⇒ Object
43 44 45 |
# File 'lib/playbook/flex_direction.rb', line 43 def flex_direction_values %w[row column rowReverse columnReverse] end |