Module: Irelia::Options::TextFormatting

Included in:
Div::Component, Flex::Component
Defined in:
lib/irelia/options/text_formatting.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
24
25
26
27
# File 'lib/irelia/options/text_formatting.rb', line 4

def self.included(base)
  base.class_eval do
    option :text, default: -> { :base }, in: [ :xs, :sm, :base, :lg, :xl, :xxl, :xxxl ]
    option :bold, default: -> { false }, in: [ true, false, :bold, :semibold, :extrabold ]

    after_initialize do
      add_css_classes(
        class_names(
          "irelia-text-base": text == :none,
          "irelia-text-xs": text == :xs,
          "irelia-text-sm": text == :sm,
          "irelia-text-lg": text == :lg,
          "irelia-text-xl": text == :xl,
          "irelia-text-2xl": text == :xxl,
          "irelia-text-3xl": text == :xxxl,
          "irelia-text-no-bold": bold == false,
          "irelia-text-bold": bold == true || bold == :bold,
          "irelia-text-semibold": bold == :semibold,
          "irelia-text-extrabold": bold == :extrabold
        )
      )
    end
  end
end