Module: Playbook::Overflow

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
# File 'lib/playbook/overflow.rb', line 5

def self.included(base)
  base.prop :overflow
  base.prop :overflow_x
  base.prop :overflow_y
end

Instance Method Details

#overflow_optionsObject



15
16
17
18
19
20
21
# File 'lib/playbook/overflow.rb', line 15

def overflow_options
  {
    overflow: "overflow",
    overflow_x: "overflow_x",
    overflow_y: "overflow_y",
  }
end

#overflow_propsObject



23
24
25
26
27
28
29
30
31
# File 'lib/playbook/overflow.rb', line 23

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

  selected_props.map do |k|
    overflow_value = send(k)
    "#{overflow_options[k]}_#{overflow_value}" if overflow_values.include? overflow_value
  end.compact.join(" ")
end

#overflow_valuesObject



11
12
13
# File 'lib/playbook/overflow.rb', line 11

def overflow_values
  %w[visible hidden scroll auto]
end