Module: Playbook::Overflow

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

Constant Summary collapse

OVERFLOW_VALUES =
%w[visible hidden scroll auto].freeze

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



17
18
19
# File 'lib/playbook/overflow.rb', line 17

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

#overflow_propsObject



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

def overflow_props
  ov = overflow
  ox = overflow_x
  oy = overflow_y
  return nil unless ov || ox || oy

  css = +""
  css << "overflow_#{ov} " if ov && OVERFLOW_VALUES.include?(ov)
  css << "overflow_x_#{ox} " if ox && OVERFLOW_VALUES.include?(ox)
  css << "overflow_y_#{oy} " if oy && OVERFLOW_VALUES.include?(oy)
  css.strip unless css.empty?
end

#overflow_valuesObject



13
14
15
# File 'lib/playbook/overflow.rb', line 13

def overflow_values
  OVERFLOW_VALUES
end