Module: Playbook::AlignContent

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



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

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

Instance Method Details

#align_content_optionsObject

rubocop:enable Style/IfInsideElse



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

def align_content_options
  {
    align_content: "align_content",
  }
end

#align_content_propsObject

rubocop:disable Style/IfInsideElse



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

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

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

#align_content_valuesObject



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

def align_content_values
  %w[start end center spaceBetween spaceAround spaceEvenly]
end