Module: Irelia::Options::Flex::Gap

Included in:
Flex::Component
Defined in:
lib/irelia/options/flex/gap.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
# File 'lib/irelia/options/flex/gap.rb', line 5

def self.included(base)
  base.class_eval do
    option :gap, default: -> { :md }, in: [ :none, :xs, :sm, :md, :lg ]

    after_initialize do
      add_css_classes(
        class_names(
          "irelia-flex--gap-none": gap == :none,
          "irelia-flex--gap-xs": gap == :xs,
          "irelia-flex--gap-sm": gap == :sm,
          "irelia-flex--gap-md": gap == :md,
          "irelia-flex--gap-lg": gap == :lg,
        )
      )
    end
  end
end