Module: Playbook::AlignItems
- Included in:
- KitBase
- Defined in:
- lib/playbook/align_items.rb
Constant Summary collapse
- ALIGN_ITEMS_VALUES =
%w[flexStart flexEnd start end center baseline stretch].freeze
- SCREEN_SIZES =
%w[xs sm md lg xl].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'lib/playbook/align_items.rb', line 5 def self.included(base) base.prop :align_items end |
Instance Method Details
#align_items_options ⇒ Object
28 29 30 |
# File 'lib/playbook/align_items.rb', line 28 def { align_items: "align_items" } end |
#align_items_props ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/playbook/align_items.rb', line 12 def align_items_props value = align_items return nil unless value if value.is_a?(::Hash) css = +"" css << "align_items_#{value[:default].underscore} " if value.key?(:default) && ALIGN_ITEMS_VALUES.include?(value[:default].to_s) value.each do |media_size, align_value| css << "align_items_#{media_size}_#{align_value.underscore} " if SCREEN_SIZES.include?(media_size.to_s) && ALIGN_ITEMS_VALUES.include?(align_value.to_s) end css.strip unless css.empty? elsif ALIGN_ITEMS_VALUES.include?(value) "align_items_#{value.underscore}" end end |
#align_items_values ⇒ Object
32 33 34 |
# File 'lib/playbook/align_items.rb', line 32 def align_items_values ALIGN_ITEMS_VALUES end |