Module: Playbook::AlignItems

Included in:
KitBase
Defined in:
lib/playbook/align_items.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/playbook/align_items.rb', line 5

def self.included(base)
  base.prop :align_items
end

Instance Method Details

#align_items_optionsObject

rubocop:enable Style/IfInsideElse



27
28
29
30
31
# File 'lib/playbook/align_items.rb', line 27

def align_items_options
  {
    align_items: "align_items",
  }
end

#align_items_propsObject

rubocop:disable Style/IfInsideElse



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/playbook/align_items.rb', line 10

def align_items_props
  selected_props = align_items_options.keys.select { |sk| try(sk) }
  return nil unless selected_props.present?

  selected_props.map do |k|
    align_items_value = send(k)
    if align_items_value.is_a?(Hash)
      align_items_value.map do |media_size, align_value|
        "align_items_#{media_size}_#{align_value.underscore}" if align_items_values.include? align_value.to_s
      end
    else
      "align_items_#{align_items_value.underscore}" if align_items_values.include? align_items_value
    end
  end.compact.join(" ")
end

#align_items_valuesObject



33
34
35
# File 'lib/playbook/align_items.rb', line 33

def align_items_values
  %w[flexStart flexEnd start end center baseline stretch]
end