Module: Playbook::AlignSelf
- Included in:
- KitBase
- Defined in:
- lib/playbook/align_self.rb
Constant Summary collapse
- ALIGN_SELF_VALUES =
%w[auto start end center stretch baseline].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_self.rb', line 5 def self.included(base) base.prop :align_self end |
Instance Method Details
#align_self_options ⇒ Object
28 29 30 |
# File 'lib/playbook/align_self.rb', line 28 def { align_self: "align_self" } end |
#align_self_props ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/playbook/align_self.rb', line 12 def align_self_props value = align_self return nil unless value if value.is_a?(::Hash) css = +"" css << "align_self_#{value[:default]} " if value.key?(:default) && ALIGN_SELF_VALUES.include?(value[:default]) value.each do |media_size, align_value| css << "align_self_#{media_size}_#{align_value} " if SCREEN_SIZES.include?(media_size.to_s) && ALIGN_SELF_VALUES.include?(align_value) end css.strip unless css.empty? elsif ALIGN_SELF_VALUES.include?(value) "align_self_#{value}" end end |
#align_self_values ⇒ Object
32 33 34 |
# File 'lib/playbook/align_self.rb', line 32 def align_self_values ALIGN_SELF_VALUES end |