Module: Playbook::ZIndex
- Included in:
- KitBase
- Defined in:
- lib/playbook/z_index.rb
Constant Summary collapse
- Z_INDEX_VALUES =
%w[1 2 3 4 5 6 7 8 9 10 max].freeze
- SCREEN_SIZES =
%w[xs sm md lg xl].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #screen_size_values ⇒ Object
- #z_index_options ⇒ Object
- #z_index_props ⇒ Object
- #z_index_values ⇒ Object
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'lib/playbook/z_index.rb', line 5 def self.included(base) base.prop :z_index end |
Instance Method Details
#screen_size_values ⇒ Object
20 21 22 |
# File 'lib/playbook/z_index.rb', line 20 def screen_size_values SCREEN_SIZES end |
#z_index_options ⇒ Object
16 17 18 |
# File 'lib/playbook/z_index.rb', line 16 def { z_index: "z-index" } end |
#z_index_props ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/playbook/z_index.rb', line 24 def z_index_props value = z_index return nil unless value if value.is_a?(::Hash) css = +"" css << "z_index_#{value[:default]} " if value.key?(:default) && Z_INDEX_VALUES.include?(value[:default].to_s) value.each do |key, val| css << "z_index_#{key}_#{val} " if SCREEN_SIZES.include?(key.to_s) && Z_INDEX_VALUES.include?(val.to_s) end css.strip unless css.empty? elsif Z_INDEX_VALUES.include?(value) "z_index_#{value}" end end |
#z_index_values ⇒ Object
12 13 14 |
# File 'lib/playbook/z_index.rb', line 12 def z_index_values Z_INDEX_VALUES end |