Module: Playbook::Hover
- Included in:
- KitBase
- Defined in:
- lib/playbook/hover.rb
Constant Summary collapse
- HOVER_SHADOW_VALUES =
%w[deep deeper deepest].freeze
- HOVER_SCALE_VALUES =
%w[sm md lg].freeze
- HOVER_BACKGROUND_VALUES =
[].freeze
- HOVER_COLOR_VALUES =
[].freeze
- HOVER_UNDERLINE_VALUES =
[true, false].freeze
- HOVER_VISIBLE_VALUES =
%w[true false].freeze
- HOVER_ATTRIBUTES =
%w[background shadow scale color underline visible].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #hover_attributes ⇒ Object
- #hover_background_values ⇒ Object
- #hover_color_values ⇒ Object
- #hover_options ⇒ Object
- #hover_props ⇒ Object
- #hover_scale_values ⇒ Object
- #hover_shadow_values ⇒ Object
- #hover_underline_values ⇒ Object
- #hover_values ⇒ Object
- #hover_visible_values ⇒ Object
Class Method Details
Instance Method Details
#hover_attributes ⇒ Object
50 51 52 |
# File 'lib/playbook/hover.rb', line 50 def hover_attributes HOVER_ATTRIBUTES end |
#hover_background_values ⇒ Object
30 31 32 |
# File 'lib/playbook/hover.rb', line 30 def hover_background_values HOVER_BACKGROUND_VALUES end |
#hover_color_values ⇒ Object
34 35 36 |
# File 'lib/playbook/hover.rb', line 34 def hover_color_values HOVER_COLOR_VALUES end |
#hover_options ⇒ Object
18 19 20 |
# File 'lib/playbook/hover.rb', line 18 def { hover: "hover" } end |
#hover_props ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/playbook/hover.rb', line 54 def hover_props value = hover gh = group_hover return nil if !value && !gh css = +"" if value if value.is_a?(::Hash) value.each do |key, val| if %i[background color].include?(key) css << "hover_#{key}-#{val} " if HOVER_ATTRIBUTES.include?(key.to_s) elsif key == :underline && val == true css << "hover_underline " elsif HOVER_ATTRIBUTES.include?(key.to_s) && send("hover_#{key}_values").include?(val.to_s) css << "hover_#{key}_#{val} " end end elsif send("hover_hover_values").include?(value) css << "hover_#{value} " end end css << "group_hover " if gh css.strip unless css.empty? end |
#hover_scale_values ⇒ Object
26 27 28 |
# File 'lib/playbook/hover.rb', line 26 def hover_scale_values HOVER_SCALE_VALUES end |
#hover_shadow_values ⇒ Object
22 23 24 |
# File 'lib/playbook/hover.rb', line 22 def hover_shadow_values HOVER_SHADOW_VALUES end |
#hover_underline_values ⇒ Object
38 39 40 |
# File 'lib/playbook/hover.rb', line 38 def hover_underline_values HOVER_UNDERLINE_VALUES end |
#hover_values ⇒ Object
46 47 48 |
# File 'lib/playbook/hover.rb', line 46 def hover_values .keys.select { |sk| try(sk) } end |
#hover_visible_values ⇒ Object
42 43 44 |
# File 'lib/playbook/hover.rb', line 42 def hover_visible_values HOVER_VISIBLE_VALUES end |