Module: Playbook::Display
- Included in:
- KitBase
- Defined in:
- lib/playbook/display.rb
Constant Summary collapse
- DISPLAY_VALUES =
%w[block inline_block inline flex inline_flex none grid].freeze
- DISPLAY_SIZE_VALUES =
%w[xs sm md lg xl].freeze
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
28 29 30 |
# File 'lib/playbook/display.rb', line 28 def { display: "display" } end |
#display_props ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/playbook/display.rb', line 12 def display_props value = display return nil unless value if value.is_a?(::Hash) css = +"" css << "display_#{value[:default]} " if value.key?(:default) && DISPLAY_VALUES.include?(value[:default].to_s) value.each do |key, val| css << "display_#{key}_#{val} " if DISPLAY_SIZE_VALUES.include?(key.to_s) && DISPLAY_VALUES.include?(val.to_s) end css.strip unless css.empty? elsif DISPLAY_VALUES.include?(value) "display_#{value}" end end |
#display_size_values ⇒ Object
32 33 34 |
# File 'lib/playbook/display.rb', line 32 def display_size_values DISPLAY_SIZE_VALUES end |
#display_values ⇒ Object
36 37 38 |
# File 'lib/playbook/display.rb', line 36 def display_values DISPLAY_VALUES end |