Module: Irelia::Options::Flex::Justify

Included in:
Flex::Component, Navbar::Section::Component, Sidebar::Section::Component, Stack::Component
Defined in:
lib/irelia/options/flex/justify.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



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

def self.included(base)
  base.class_eval do
    option :justify, default: -> { nil }, in: %i[start center between around evenly stretch end]

    after_initialize do
      add_css_classes(
        class_names(
          "irelia-justify-start": justify == :start,
          "irelia-justify-center": justify == :center,
          "irelia-justify-between": justify == :between,
          "irelia-justify-end": justify == :end,
          "irelia-justify-around": justify == :around,
          "irelia-justify-evenly": justify == :evenly,
          "irelia-justify-stretch": justify == :stretch
        )
      )
    end
  end
end