Module: Irelia::Options::Fixed

Included in:
Div::Component, Flex::Component
Defined in:
lib/irelia/options/fixed.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/irelia/options/fixed.rb', line 4

def self.included(base)
  base.class_eval do
    option :fixed, default: -> { false }, in: [ :top, :top_right, :right, :bottom_right, :bottom, :bottom_left, :left, :top_left ]

    after_initialize do
      add_css_classes(
        class_names(
          "irelia-fixed-top": fixed == :top,
          "irelia-fixed-top-right": fixed == :top_right,
          "irelia-fixed-right": fixed == :right,
          "irelia-fixed-bottom-right": fixed == :bottom_right,
          "irelia-fixed-bottom": fixed == :bottom,
          "irelia-fixed-bottom-left": fixed == :bottom_left,
          "irelia-fixed-left": fixed == :left,
          "irelia-fixed-top-left": fixed == :top_left
        )
      )
    end
  end
end