Module: NfgUi::Components::Traits::Icon

Included in:
Foundations::Icon
Defined in:
lib/nfg_ui/components/traits/icon.rb

Overview

Access to pre-designed Icon traits

Constant Summary collapse

TRAITS =
%i[loader tip].freeze

Instance Method Summary collapse

Instance Method Details

#loader_traitObject



10
11
12
# File 'lib/nfg_ui/components/traits/icon.rb', line 10

def loader_trait
  options[:icon] = 'spinner spin fw'
end

#tip_traitObject

The defacto “(?)” tip icon Usage: ui.nfg :icon, :tip, tooltip: ‘The tip’



17
18
19
20
21
22
23
24
25
# File 'lib/nfg_ui/components/traits/icon.rb', line 17

def tip_trait
  options[:icon] = NfgUi::DEFAULT_TIP_ICON
  options[:theme] = NfgUi::DEFAULT_TIP_THEME

  if options[:text].present?
    options[:right] = true
    options[:class] += ' fa-fw'
  end
end