Module: Playbook::Display
- Included in:
- KitBase
- Defined in:
- lib/playbook/display.rb
Class Method Summary collapse
Instance Method Summary collapse
- #display_options ⇒ Object
- #display_props ⇒ Object
- #display_size_values ⇒ Object
- #display_values ⇒ Object
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'lib/playbook/display.rb', line 5 def self.included(base) base.prop :display end |
Instance Method Details
#display_options ⇒ Object
27 28 29 30 31 |
# File 'lib/playbook/display.rb', line 27 def { display: "display", } end |
#display_props ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/playbook/display.rb', line 9 def display_props selected_props = .keys.select { |sk| try(sk) } responsive = selected_props.present? && try(:display).is_a?(::Hash) css = "" if responsive display_value = send(:display) display_value.each do |key, value| css += "display_#{key}_#{value} " if display_size_values.include?(key.to_s) && display_values.include?(value.to_s) end else selected_props.each do |k| display_value = send(k) css += "display_#{display_value}" if display_values.include? display_value end end css unless css.blank? end |
#display_size_values ⇒ Object
33 34 35 |
# File 'lib/playbook/display.rb', line 33 def display_size_values %w[xs sm md lg xl] end |
#display_values ⇒ Object
37 38 39 |
# File 'lib/playbook/display.rb', line 37 def display_values %w[block inline_block inline flex inline_flex none] end |